TIPS & TRICKS
To search the contents of the man pages
# man -k searchterm |
Configure autofs task examples
Always:
# dnf install nfs-utils autofs -y |
# systemctl enable autofs --now |
Configure autofs 1
| Configure autofs to automount the home directories of netuserX user.
| Note theFollowing:
| - netuserX home directory is exported via NFS, which is available on classroom.example.com(192.168.1.43)
| and your NFS-exports directory is /netdir/netuserX for netuserX (use netuser5 for this)
| - netuserX’s home directory is classroom.example.com:/home/guests/netuserX
| - netuserX’s home directory should be automounted using autofs service.
| - home directories must be writable by their users
| - on server: change IP address in /etc/exports. Also “systemctl restart nfs-server”
# sudo yum install nfs-utils autofs -y |
# showmount -e 192.168.1.43 |
Create the /etc/auto.master.d/netusers.autofs file:
# vim /etc/auto.master.d/netusers.autofs |
# vim /etc/netusers.master |
# systemctl enable autofs --now |
# su - netuser5 |
Configure autofs 2
| Configure autofs to automount the home directories of LDAP users.
| - classroom.example.com (172.25.254.254) NFS-exports /home/guests to your system, whereX is Your server number
| - LDAP userX home directory is classroom.example.com:/home/guests/ldapuserX
| - ldapuserX home directory should be automounted locally beneath /home as /home/guests/ldapuserX
| - home directories must be writable by their users
| - while You are able to login as any of the users ldapuser1-20 the only home directory You are able to access is ldapuserX
First we have to install autofs for usage:
# yum install -y autofs |
Then we have to create config file for autofs that holds configuration and put below content (start point for indirect mounts - conf file for this specific mount).
Name of the config file in /etc/auto.master.d is not important - the only important thing is that is must have .autofs suffix :
# vi /etc/auto.master.d/home.autofs |
As we mention config file in the previous step we have to create it and put below contents there:
# vi /etc/auto.home |
Using wildcard * sign as a first parameter and & as the same in path on remote server will make sure that any user that is logged using LDAP will have its name used as parameter for mounting.
Make sure that the service autofs is enabled and started:
# systemctl enable autofs.service |
Just SSH locally with user that is supposed to exist on LDAP server and check the home directory:
# ssh ldapuser5@localhost |
Configure autofs 3
| Configure a direct map to automount the NFS share /common that is available from server2.
| Install the relevant software, create a local mount point /autodir, and set up AutoFS maps to support the automatic mounting.
| Note that /common is already mounted on the /local mount point on server1 via fstab.
| Ensure there is no conflict in configuration or functionality between the 2
# dnf install -y autofs |
# mkdir /autodir |
# vim /etc/auto.master/autodir.autofs |
# vim /etc/autodir.master |
Documentations
Internet
Git
ChatGPT