Changes

Jump to: navigation, search

OPS335 NIS Lab

237 bytes added, 15:15, 27 June 2013
Modified sections B,C,D for clarity
===PART B: Adding VM03 to your NIS domain===
*Ensure your VM03 is still mounting your home directory from the host machine using autofs. If not revisit last weeks lab.
*Install ypbind on your vm03.*SSH to vm03 using two terminals, following your logs with one using tail -f /var/log/messages*Use the other to edit /etc/yp.conf adding the following line: domain <learnid>.org server 192.168.x.1*Add the following line to the bottom of the file /etc/sysconfig/network NISDOMAIN="<learn-id>.org"*Start the ypbind server with the command. systemctl start ypbind.service*Looking at your logs ensure that ypbind is registered with rpcbind, if it is unable your firewall may need to be adjusted.*Now when you run the following command: ypcat passwd*You should be able to see the 'nis-user' entry added to the host machine.*Modify /etc/nsswitch so that this vm will check with NIS before looking at its own files for passwd, shadow, and group. ===Part C: Adding the other VM's===*Many of you had an issue last week when using NFS as you had differing GID & UID's between systems - when attempting to mount the home directory from the host you received various permission issues. We In case you did not experience it, we will intentionally create this issue on vm02 and then correct it with NIS.*SSH to the root account on vm02 and run Run the following command
cat /etc/passwd | grep home
*Look at the existing users and compare them with the same users on the host machine. Find one whose credentials differ (if none do, create two).
*For example on vm02vm03: [root@<b>vm02</b> vm03 ~]# cat /etc/passwd | grep home
nis-user:x:1000:1000::/home/nis-user:/bin/bash
paul:x:1001:1001::/home/paul:/bin/bash
*And on the host:
[root@f16 ypf17 ~]# cat /etc/passwd | grep home
paul:x:1000:1000:paul:/home/paul:/bin/bash
nis-user:x:1001:1001::/home/nis-user:/bin/bash
*While the two hosts share the same users, their UID and GID are different. This will cause a problem when mounting the home directory using NFS.
*Add an entry Back on vm03 try to your fstab so that you are mounting the home directories from the host machine, then mount and switch to your learnid (or other account where UID/GID differs between systems)
su <learnid>
cd ~
*You should recieve a permission denied error as the UID on the local system differs from the UID of the file owner on the remote server. Change back to your root account*Obtain a listing of the directories in /home: [paul@vm03 /]# ls -l /home drwx------. 3 nis-user nis-user 4096 Mar 11 19:13 paul*Notice that one user's home directory shows up as being owned by a different user.*cd into Try to access the other user's home directory of the (it should show up as owned by this user): [paul@vm03 /]# cd /home/nis-user whose UID on the host matches the UID on your vm.
*You should now be successful. Obtain a directory listing. Below is some example output:
[paul@vm02 ~vm03 /home/nis-user]$ ll total 384 -rw-rw-r--. 1 nis-user nis-user 0 Mar 11 19:13 another_empty_file_from_vm03 drwxr-xr-x. 2 nis-user nis-user paul paul 4096 Mar 14 09:09 Desktop drwxr-xr-x. 2 nis-user nis-user paul paul 4096 Feb 17 05:24 Documents drwxr-xr-x. 2 nis-user nis-user paul paul 4096 Feb 17 05:45 Downloads drwxr-xr-x. 2 nis-user nis-user paul paul 4096 Jan 4 10:12 Music drwxr-xr-x. 2 nis-user nis-user paul paul 4096 Jan 4 10:12 Pictures drwxr-xr-x. 2 nis-user nis-user paul paul 4096 Jan 4 10:12 Public drwxr-xr-x. 2 nis-user nis-user paul paul 4096 Jan 4 10:12 Templates drwxr-xr-x. 2 nis-user nis-user paul paul 4096 Jan 4 10:12 Videos
*Create an empty file and do a listing again
[paul@vm02 vm03 ~]$ touch empty_from_vm02empty_from_vm03 [paul@vm02 vm03 ~]$ ll -rw-rw-r--. 1 paul paul 0 Mar 18 14:58 empty_from_vm02empty_from_vm03*And finally drwxr-xr-x. 2 paul paul 4096 Mar 14 09:09 Desktop drwxr-xr-x. 2 paul paul 4096 Feb 17 05:24 Documents drwxr-xr-x. 2 paul paul 4096 Feb 17 05:45 Downloads drwxr-xr-x. 2 paul paul 4096 Jan 4 10:12 Music drwxr-xr-x. 2 paul paul 4096 Jan 4 10:12 Pictures drwxr-xr-x. 2 paul paul 4096 Jan 4 10:12 Public drwxr-xr-x. 2 paul paul 4096 Jan 4 10:12 Templates pwddrwxr-xr-x. 2 paul paul 4096 Jan 4 10:12 Videos*Notice you are in the other user's home directory, however files show they are owned Now we will fix this problem by your current making this machine use NIS for user, .information
*Change users back to root
*Install ypbindon your vm03.* You may wish to follow the logs on vm03. In addition to your normal log in, configure it ssh from the host to use your vm03 and get a continuous feed from the logs with: tail -f /var/log/messages*Edit /etc/yp.conf adding the following line: domain and NIS <learnid>.org server 192.168.x.1*Add the following line to the bottom of the file /etc/sysconfig/network NISDOMAIN="<learn-id>.org"*Start the ypbind server and with the command. systemctl start ypbind.service*Looking at your logs ensure that ypbind is registered with rpcbind, if it is unable your firewall may need to be adjusted.*Now when you run the following command: ypcat passwd*You should be able to see the service'nis-user' entry from the host machine, matching its credentials.
*Edit the /etc/nsswitch file change the following lines as they appear below:
passwd: nis files
*Ensure ypbind will start at boot and restart the vm.
*Again SSH to the machine, this time using your learnid account. You should now be able to see the files in your home directory with the correct mapping.
*Edit the fstab and remove the entry for NFS.
===Part DC: Adding Obtaining autofs mapsthrough NIS:===
*Make sure autofs service is installed on your vm. If not then install from yum.
*Copy the autofs files from vm03 to your host machine
*After making changes to your Makefile, regenerate your maps again and run the same command as above. You should now see the file and its contents when you run ypcat auto.home.
[root@f16 yp]# ypcat auto.home
-fstype=nfsnfs4,rw,nosuid,soft 192.168.70.1:/home/&*SSH to vm02 On vm03 delete the autofs files, and edit the /etc/nsswitch.conf file and make changes so that autofs consults NIS. Reboot the machine.
*When the VM comes back up, SSH and ensure auto mounting of home occurred.
 ===Part D: Adding the other VM's===*When you have successfully made this change on vm02vm03, repeat the these steps needed for so that vm01 and vm03 to use NIS for user identification, and mount home directories using autofs. 
==Completing the Lab==
932
edits

Navigation menu