RHCSA Rapid Track
In this lab, you will manually mount a Kerberos-secured NFS share, access it, and optionally unmount it. Create a persistent share mount in /etc/fstab, mount it, and access it. serverX is the NFSv4 host.
| Resources: | |
|---|---|
| Files: |
nfs_ldapuserX.txt and
nfs_student.txt |
| Machines: | desktopX and serverX |
Outcomes
User
ldapuserXwill be able to successfully log in and access the persistently mounted NFS sharepublicat/mnt/public.The NFS share
manualcan be mounted by users on an ad hoc basis at/mnt/manual.
Reset the serverX system.
Log into and set up your server system.
[student@serverX ~]$lab nfsmount setupReset the desktopX system.
Log into and set up your desktop system.
[student@desktopX ~]$lab nfsmount setupOpen a terminal.
Important
The serverX setup is used for both practice exercises in this chapter. It only needs to be run once.
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 most directories is via
LDAP-based users, authenticating using Kerberos; however, a number of shares are using
standard Linux file access security. Users need to be able to log in and mount the
manual NFS share, and should have the public NFS
share available constantly.
Here are the key details you will need:
Username:
ldapuserXPassword:
kerberosserverX is sharing two directories under
/shares:manualandpublic.desktopX mount point:
/mnt/publicand/mnt/manualThe
publicNFS share requireskrb5pauthentication to access;manualis usingsyssecurity.The
krb5.keytabis available fromhttp://classroom.example.com/pub/keytabs/desktopX.keytab.Each share should have read and write access.
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 mkdir to create both mount points:
/mnt/publicand/mnt/manual.[student@desktopX ~]$sudo mkdir -p /mnt/{public,manual}Create the persistent mount. This mount will only be accessible to authenticated users.
Use vim to edit the
/etc/fstabfile.[student@desktopX ~]$sudo vim /etc/fstabAdd this line to the end of the file:
serverX:/shares/public /mnt/public nfs sec=krb5p,sync 0 0
Use mount to mount the share and begin using it.
[student@desktopX ~]$sudo mount -a
Use mount to manually mount
/shares/manualon/mnt/manual. Since you already have a kerberized NFSv4 mount from the same server you will need to specify thesec=sysoption.[student@desktopX ~]$sudo mount -o sync,sec=sys serverX:/shares/manual /mnt/manualUse 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 both share directories and confirm you have read/write access.
Use cd to switch directories.
[ldapuserX@desktopX ~]$cd /mnt/manualUse echo and cat to verify read and write access.
[ldapuserX@desktopX manual]$echo hello > test.txt[ldapuserX@desktopX manual]$cat test.txthelloRepeat this step to test
/mnt/public.Use exit or Ctrl+D to log out of
ldapuserX.Repeat the previous step as
studenton both directories. You should be able to change directory and list/mnt/manual, but getPermission deniedon/mnt/publicbecausestudentcannot authenticate using Kerberos.Instead of
test.txt, you will want to use something liketest2.txt, sincestudentis not allowed to write to files owned byldapuser.X
Note
When you are finished using the network storage, you can use the umount command to manually unmount the NFS shares.
[student@desktopX ~]$sudo umount /mnt/manual