NIS & NFS USER
This is Testing Example For NIS & NFS Server
NIS Server Side Configuration:
Create user and password in NIS server machine (sandeeplinux3)
[root@sandeeplinux3 ~]# useradd -g users nisnfs
[root@sandeeplinux3 ~]# passwd nisnfs
Changing password for user nisnfs.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Add User in NIS machine
[root@sandeeplinux3 ~]# cd /var/yp/
[root@sandeeplinux3 yp]# make
gmake[1]: Entering directory `/var/yp/sandeep-NIS-SERVER'
Updating passwd.byname...
Updating passwd.byuid...
Updating netid.byname...
gmake[1]: Leaving directory `/var/yp/sandeep-NIS-SERVER'
Checke With user with NIS user
[root@sandeeplinux3 yp]# ypmatch nisnfs passwd
nisnfs:$1$QVtgvZ4p$WEAqYqjiOnnizEkFs5IEk.:516:100::/home/nisnfs:/bin/bash
[root@sandeeplinux3 yp]# getent passwd nisnfs
nisnfs:x:516:100::/home/nisnfs:/bin/bash
Share nisnfs user's Home directory in NFS server:
[root@sandeeplinux3 home]# vi /etc/exports
/home/nfsdir 192.168.1.10(rw,sync)
/home/nisnfs sandeeplinux2(rw,sync)
:wr [Save & Exit]
Make sure nisnfs user home directory has mounted in NFS server
[root@sandeeplinux3 home]# exportfs -ra
[root@sandeeplinux3 home]# exportfs
/home/nfsdir sandeeplinux2
/home/nisnfs sandeeplinux2
[root@sandeeplinux3 home]#
NFS Client Side Configuration:
Go to NFS Client Machine(sandeeplinux2) and create one directory in /home
[root@sandeeplinux2 home]# mkdir nisnfs
[root@sandeeplinux2 home]# ls -ltr
Checke with Directory user & group permission
[root@sandeeplinux2 home]# ls -ltr
drwxr-xr-x 2 root root 4096 Mar 4 12:29 nisnfs
Mount nisnfs user's home directory(sandeeplinux3 server) in (sandeeplinux2 client)/home/nisnfs directory
[root@sandeeplinux2 home]# mount 192.168.1.11:/home/nisnfs/ /home/nisnfs/
Check directory permission after mounting with NFS Server
[root@sandeeplinux2 home]# ls -ltr
drwx------ 5 nisnfs users 4096 Mar 4 2010 nisnfs
Note: After Mounting nisnfs home directory on client, it should be change like Server nisnfs user permissions.
Troubleshoot:
If once modified /etc/exports file in server machine and client machine not able to mount the shared directory means
Restart all services one by one in Server Machine & Client Machine.
Server Machine:
service portmap restart
service nfslock restart
service nfs restart
Client Machine:
service portmap restart
service nfslock restart
service netfs restart