So I have created two Centos machines. One is configured as a NIS master and the second is a NIS cleint. The NIS configs are all working perfectly.
I created a user nisuser on NIS Master and I can use it on the client. BUT it doesnt show a home directory . Ive been told there is something else like automount of autfs that I need to configure that will automount the home directory onto any client. I havent done any such configs.
Can you guys guide me as to what exactly I need to study or redirect me to a good tutorial ?
You're confounding NIS with NFS. The former allows hosts to share information services such as the user database and hostnames. The latter allows home directories to be shared (for instance).
The NIS Master and NFS master do not have to be the same host, but it's not unsual to make it so. On the NFS Master, you install the nfs tools and start the nfs service. You modify /etc/exports (man 5 exports) to tell NFS to export some path, ie /home:
Where "master" is the hostname of your NFS master. Then run mount:
# mount -a -t nfs
Let's say you have a user Joe, who is listed in the NIS user database and has a home directory on host "master" as /home/joe. When you login on the "client" host as user Joe, the home directory should be available. If the login process hangs or you get the error "No such directory" then something went wrong.
So autofs builds on NFS in the way that each directory will be mounted "on demand" and unmounted after a few minutes of inactivity. It is largely a pointless technology, but it still has its uses. The server set up is essentially the same. For the client setup, don't use the fstab entry, but rather, configure autofs and enable the autofs daemon with chkconfig.
I haven't done this in a while, but the following might work:
/etc/auto.master
/home /etc/auto.home --timeout 600
To /etc/auto.home:
* -fstype=nfs master:/home/&
Then restart autofs
---------- Post updated at 10:46 PM ---------- Previous update was at 10:44 PM ----------
There is a caveat to working with autofs: The top-level directory must not exist before autofs is started. Try this (on the client): NOTE: THIS WILL DESTROY EVERYTHING IN /HOME ON THE CLIENT
service autofs stop
rm -rf /home
service autofs start
[root@Barium home]# service autofs stop
Stopping automount: [ OK ]
[root@Barium home]# rm -rf /home
[root@Barium home]# service autofs start
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Starting automount: [ OK ]
[root@Barium home]# su - nisuser
su: warning: cannot change directory to /home/nisuser: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
-bash-4.1$