NIS Server

Posted: August 7, 2013 in Uncategorized

# rpm -q  ypserv  yp-bind  portmap
#yum install ypserv ypbind portmap
# vim /etc/sysconfig/network
NISDOMAIN=mydomain.com
#nisdomainname  ( if it null set it manually)
#/usr/lib/yp/ypinit -m    ( follow the instructions )
#chkconfig ypserv on
#service ypserv start
#useradd -g users nisuser
#passwd nisuser
#cd /var/yp
#make
#vi /etc/exports (configure nfs to automount the home directory from client machine)
#service nfs start
#chkconfig nfs on

########### In Client machine #############
#authconfig-tui
(configuration of automount part)
login with root in the nis client
#vi /etc/auto.master
It is like this
/autodir /etc/auto.misc
#vi /etc/auto.misc
/autodir/mountdir -rw,soft,intr nfsserver:/nfsshare
#service autofs start
Interview Questions and Answers:-

  1. what is nis ?

Here are the steps to configure the NFS server in this scenario:
1. Edit the /etc/exports file to allow NFS mounts of the /home directory with read/write access.
/home *(rw,sync)
2. Let NFS read the /etc/exports file for the new entry, and make /home available to the network with the exportfs command.
[root@akhan tmp]# exportfs -a
[root@akhan tmp]#
3. Make sure the required nfs, nfslock, and portmap daemons are both running and configured to start after the next reboot.
[root@akhan tmp]# chkconfig nfslock on
[root@akhan tmp]# chkconfig nfs on
[root@akhan tmp]# chkconfig portmap on
[root@akhan tmp]# service portmap start
Starting portmapper: [ OK ]
[root@akhan tmp]# service nfslock start
Starting NFS statd: [ OK ]
[root@akhan tmp]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@akhan tmp]#
After configuring the NIS server, we have to configure its clients, This will be covered next.
Configuring The NFS Client
You also need to configure the NFS clients to mount their /home directories on the NFS server.
These steps archive the /home directory. In a production environment in which the /home directory would be actively used, you’d have to force the users to log off, backup the data, restore it to the NFS server, and then follow the steps below. As this is a lab environment, these prerequisites aren’t necessary.
1. Make sure the required netfs, nfslock, and portmap daemons are running and configured to start after the next reboot.
[root@akhan tmp]# chkconfig nfslock on
[root@akhan tmp]# chkconfig netfs on
[root@akhan tmp]# chkconfig portmap on
[root@akhan tmp]# service portmap start
Starting portmapper: [ OK ]
[root@akhan tmp]# service netfs start
Mounting other filesystems: [ OK ]
[root@akhan tmp]# service nfslock start
Starting NFS statd: [ OK ]
[root@akhan tmp]#
2. Keep a copy of the old /home directory, and create a new directory /home on which you’ll mount the NFS server’s directory.
[root@akhan tmp]# mv /home /home.save
[root@akhan tmp]# mkdir /home
[root@akhan tmp]# ll /


drwxr-xr-x 1 root root 11 Nov 16 20:22 home
drwxr-xr-x 2 root root 4096 Jan 24 2003 home.save


[root@akhan tmp]#
3. Make sure you can mount bigboy’s /home directory on the new /home directory you just created. Unmount it once everything looks correct.
[root@akhan tmp]# mount 192.168.1.100:/home /home/
[root@akhan tmp]# ls /home
ftpinstall nisuser quotauser smallfry www
[root@akhan tmp]# umount /home
[root@akhan tmp]#
4. Start configuring autofs automounting. Edit your /etc/auto.master file to refer to file /etc/auto.home for mounting information whenever the /home directory is accessed. After five minutes, autofs unmounts the directory.
#/etc/auto.master
/home /etc/auto.home –timeout 600
5. Edit file /etc/auto.home to do the NFS mount whenever the /home directory is accessed. If the line is too long to view on your screen, you can add a \ character at the end to continue on the next line.
#/etc/auto.home
* -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid,tcp \
192.168.1.100:/home:&
6. Start autofs and make sure it starts after the next reboot with the chkconfig command.
[root@akhan tmp]# chkconfig autofs on
[root@akhan tmp]# service autofs restart
Stopping automount:[ OK ]
Starting automount:[ OK ]
[root@akhan tmp]#
After doing this, you won’t be able to see the contents of the /home directory on bigboy as user root. This is because by default NFS activates the root squash feature, which disables this user from having privileged access to directories on remote NFS servers. You’ll be able to test this later after NIS is configured.
Note: This automounter feature doesn’t appear to function correctly in my preliminary testing of Fedora Core 3. See Chapter 29, “Remote Disk Access with NFS”, for details.
All newly added Linux users will now be assigned a home directory under the new remote /home directory. This scheme will make the users feel their home directories are local, when in reality they are automatically mounted and accessed over your network.

Comments
  1. […] NIS Server (afzalkhanlinuxtalk.wordpress.com) […]

Leave a comment