Configure Users Home Directory OpenLDAP Server to CentOS 7 Client Machine
Configure "Mount" Users Home Directory from OpenLDAP Server to CentOS 7 Client Machine/Red Hat 7 Client Machine
To access personal home folders and files from OpenLDAP Server to CentOS Linux 7 client machines use Network File Sharing (NFS) Server. NFS server use to access file and folders from Linux to Linux machine. Use NFS with AutoFS feature package to auto mount the users home directory form OpenLDAP Server to CentOS Linux 7 client machines.
Server Side Configuration "OpenLDAP Server"
To mount Home Directory of OpenLDAP users from OpenLDAP Server to CentOS Linux 7 client machine use "exports" file that available in "/etc/exports" directory.
Edit the "exports" file by use of vi editor.
vi /etc/exports
Edit the below line in "exports" file.
/home/ *(rw,sync)
To Install NFS Server packages "rpcbind and nfs-utils" on OpenLDAP Server type the below command.
yum -y install rpcbind nfs-utils
NFS server packages has successfully installed.
After install the NFS Server packages start and enable the rpcbind and nfs services. To start and enable the rpcbind and nfs services on OpenLDAP Server type the below commands.
systemctl start rpcbindsystemctl start nfssystemctl enable rpcbindsystemctl enable nfs
Type the below commands to check home directory has configured for mount from OpenLDAP Server to CentOS Linux 7 client machine.
showmount -e localhostshowmount -e
Allow Firewall "Firewalld" rules on OpenLDAP Server for connect CentOS Linux 7 client machine "Linux2" to OpenLDAP Server.
firewall-cmd --permanent --add-port=111/tcpfirewall-cmd --permanent --add-port=2049/tcpfirewall-cmd --permanent --add-port=20048/tcpfirewall-cmd --permanent --add-port=111/udpfirewall-cmd --permanent --add-port=2049/udpfirewall-cmd --permanent --add-port=20048/udpfirewall-cmd --reload
Client Side Configuration "Linux2"
To Install NFS client packages "rpcbind and nfs-utils" on CentOS Linux 7 client machine "Linux2" type the below command.
yum -y install rpcbind nfs-utils
The NFS client packages has successfully installed.
After install the NFS client packages start and enable the rpcbind and nfs services. To start and enable the rpcbind and nfs services on CentOS Linux 7 client machine "Linux2" type the below commands.
systemctl start rpcbindsystemctl start nfssystemctl enable rpcbindsystemctl enable nfs
For auto mount the Home Directory from OpenLDAP Server to CentOS Linux 7 client machine install Autofs package. To install autofs package on CentOS Linux 7 client machine "Linux2" type the below command.
yum install –y autofs
Autofs package has successfully installed on CentOS Linux 7 client machine "Linux2".
Configure the autofs file "auto.master" that available in "/etc/auto.master" directory. To configure the "auto.master" file by use of vi editor.
vi /etc/auto.master
Edit the below line in "auto.master" file to mount the home directory from OpenLDAP Server to CentOS Linux 7 client machine "Linux2".
/home /etc/home.map
In the above image /home is mount point of CentOS Linux 7 client machine "Linux2" and /etc/home.map file is the configuration file to connect OpenLDAP Server with CentOS Linux client machine "Linux2".
To configure the "home.map" file by use of vi editor type the below command.
vi /etc/home.map
Edit the below line in "home.map" file.
* -fstype=auto ldap-dns.pakistan.local:/home/&
To enable and restart autofs service type below commands.
systemctl enable autofssystemctl restart autofs
To Check the OpenLDAP users home directory is export from OpenLDAP Server to CentOS Linux 7 client machine "Linux2" type the below command.
showmount -e ldap-dns.pakistan.local
To check the home directory of OpenLDAP user "user1" is auto mount, Switch from root user to OpenLDAP user1.
su - user1
In the above image you can see that home directory of user1 is auto mount from OpenLDAP Server "ldap-dns.pakistan.local" to CentOS Linux 7 client machine "Linux2.pakistan.local". ls command is use to list files and folders in current location. pwd command is use to give the complete path of current directory. Currently user1 is present in its own home directory.
Create file in user1 home directory type the below command
touch pakistan
In above image ls command is use to check pakistan file has created.
Verify the pakistan file is available in OpenLDAP Server Home Directory
Enter in the home directory of user1 by use of cd command then type ls command to list the files and folder of user1 home directory.
cd /home/user1ls
Thanks for read this Article
Comments
Post a Comment