|
NIS Server
|
| Build NIS Server in order to share users' accounts in local networks. It's neccessary to install ypserv for NIS. |
|
[root@ns ~]# yum -y install ypserv [root@ns ~]# ypdomainname server-linux.info # set NIS domain [root@ns ~]# vi /etc/sysconfig/network NETWORKING=yes NETWORKING_IPV6=yes HOSTNAME=ns.server-linux.info GATEWAY=192.168.0.1 # add at the bottom of file NISDOMAIN=server-linux.info [root@ns ~]# vi /var/yp/Makefile # MERGE_PASSWD=true|false # line 42: change MERGE_PASSWD= false # # MERGE_GROUP=true|false # line 46: change MERGE_GROUP= false # # line 109: add all: passwd shadow group hosts rpc services netid protocols[root@ns ~]# vi /var/yp/securenets host 127.0.0.1 255.255.255.0 192.168.0.0 # create a directory for web site automatically when a user is added in the system [root@ns ~]# mkdir /etc/skel/public_html [root@ns ~]# chmod 711 /etc/skel/public_html # create a directory for email automatically when a user is added in the system [root@ns ~]# mkdir -p /etc/skel/Maildir/cur [root@ns ~]# mkdir -p /etc/skel/Maildir/new [root@ns ~]# mkdir -p /etc/skel/Maildir/tmp [root@ns ~]# chmod -R 700 /etc/skel/Maildir/ [root@ns ~]# /etc/rc.d/init.d/portmap start Starting portmap: [ OK ] [root@ns ~]# /etc/rc.d/init.d/ypserv start Starting YP server services: [ OK ] [root@ns ~]# /etc/rc.d/init.d/yppasswdd start Starting YP passwd service: [ OK ] [root@ns ~]# chkconfig portmap on [root@ns ~]# chkconfig ypserv on [root@ns ~]# chkconfig yppasswdd on [root@ns ~]# useradd cent [root@ns ~]# passwd cent Changing password for user cent. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@ns ~]# /usr/lib/yp/ypinit -m # update NIS database At this point, we have to construct a list of the hosts which will run NIS servers. ns.server-linux.info is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the list, type a <control D>. next host to add: ns.server-linux.info next host to add: # push Ctrl + D keys The current list of NIS servers looks like this: ns.server-linux.info Is this correct? [y/n: y] y # input 'y' and push Enter key We need a few minutes to build the databases... Building /var/yp/server-linux.info/ypservers... Running /var/yp/Makefile... gmake[1]: Entering directory `/var/yp/server-linux.info' Updating passwd.byname... Updating passwd.byuid... Updating group.byname... Updating group.bygid... Updating hosts.byname... Updating hosts.byaddr... Updating rpc.byname... Updating rpc.bynumber... Updating services.byname... Updating services.byservicename... Updating netid.byname... Updating protocols.bynumber... Updating protocols.byname... Updating mail.aliases... gmake[1]: Leaving directory `/var/yp/server-linux.info' ns.server-linux.info has been set up as a NIS master server. Now you can run ypinit -s ns.server-linux.info on all slave server. # It's neccessary to update NIS database with following way if new user is added again [root@ns ~]# cd /var/yp [root@ns yp]# |