RHCSA Rapid Track
In this lab, you will install a package to support automount. Create a direct-map automount and an indirect-map automount using wildcards. serverX is the NFSv4 host.
| Resources: | |
|---|---|
| Files: |
nfs_ldapuserX.txt |
| Machines: | desktopX and serverX |
Outcomes
User ldapuserX will be able to successfully log in and use the three
automounted directories.
Reset the desktopX system.
Log into and set up your desktop system.
[student@desktopX ~]$lab nfsmount setupOpen a terminal.
Important
The serverX setup performed at the beginning of "Mounting and Unmounting NFS" is used for this practice exercise as well. If you have not yet performed the server setup, then run it now. It only needs to be run once for both practice exercises.
S.H.I.E.L.D. (Storage Hardware Incorporating Every Last Document) uses a central server, serverX, to host a number of document share directories. Access to these directories is via LDAP-based users, authenticating using Kerberos with encryption. Users need to be able to log in and have the share directories automount with read and write access, ready for use.
Here are the key details you will need:
Username:
ldapuserXPassword:
kerberosserverX is sharing three directories under
/shares:docs,work, andpublic.File access is secured using Kerberos with encryption:
krb5p.desktopX mount point:
/sharesfordocsandworkand a direct map ofpublicto/mnt/public.The
krb5.keytabis available fromhttp://classroom.example.com/pub/keytabs/desktopX.keytab.Each share should have read and write access.
When done with the work, reboot the desktopX machine, then run the command
lab nfsmount grade from the desktopX machine to verify
the work.
Download and install the
krb5.keytabfile to enable Kerberos access and security.[student@desktopX ~]$sudo wget -O /etc/krb5.keytab http://classroom.example.com/pub/keytabs/desktopX.keytabEnable and start the
nfs-secureservice.[student@desktopX ~]$sudo systemctl enable nfs-secureln -s '/usr/lib/systemd/system/nfs-secure.service' ...[student@desktopX ~]$sudo systemctl start nfs-secureUse yum to install
autofs, needed for automounting directories.[student@desktopX ~]$sudo yum -y install autofsLoaded plugins: langpacks Resolving Dependencies ... Complete!Create the automount configuration files for the direct-map automount.
Use vim to create and edit the
/etc/auto.master.d/direct.autofsfile.[student@desktopX ~]$sudo vim /etc/auto.master.d/direct.autofsNote: The file extension must be
.autofs.Add the line as follows:
/- /etc/auto.direct
Use vim to create and edit the
auto.directmap file.[student@desktopX ~]$sudo vim /etc/auto.directAdd the line as follows:
/mnt/public -rw,sync,sec=krb5p serverX:/shares/public
Note: The file names above are not important; they were chosen to be meaningful.
Create the automount configuration files for the indirect-map automounts.
Use vim to create and edit the
/etc/auto.master.d/shares.autofsfile.[student@desktopX ~]$sudo vim /etc/auto.master.d/shares.autofsNote: The file extension must be
.autofs.Add the line as follows:
/shares /etc/auto.shares
Use vim to create and edit the
auto.sharesmap file.[student@desktopX ~]$sudo vim /etc/auto.sharesAdd the line as follows:
* -rw,sync,sec=krb5p serverX:/shares/&
Note: The file names above are not important; they were chosen to be meaningful.
Use mkdir to create the
/mnt/publicmount point for the direct-map automount.[student@desktopX ~]$sudo mkdir -p /mnt/publicEnable and start the automount service.
[student@desktopX ~]$sudo systemctl enable autofsln -s '/usr/lib/systemd/system/autofs.service' ...[student@desktopX ~]$sudo systemctl start autofsUse ssh to switch to
ldapuserXonlocalhostand confirm the mounts, and read/write access.Use ssh to log in as
ldapuserX.[student@desktopX ~]$ssh ldapuserX@localhostIf you see something similar to the following, type
yesto accept and continue.The authenticity of host 'localhost (::1)' can't be established. ECDSA key fingerprint is d9:cc:73:82:3b:8a:74:e4:11:2f:f3:2b:03:a4:46:4d. Are you sure you want to continue connecting (yes/no)?
yesEnter the password:
kerberos.ldapuserX@localhost's password:
kerberosVerify you can switch to the automounted share directories and confirm you have read/write access.
Use cd to switch directories.
[ldapuserX@desktopX ~]$cd /shares/docsUse echo and cat to verify read and write access.
[ldapuserX@desktopX docs]$echo hello > test.txt[ldapuserX@desktopX docs]$cat test.txthelloRepeat this step to test
/shares/workand/mnt/public.Use exit or Ctrl+D to log out of
ldapuserX.
Reboot the
desktopXmachine, then run the command lab nfsmount grade from thedesktopXmachine to verify the work.[student@desktopX ~]$sudo systemctl reboot[student@desktopX ~]$lab nfsmount grade