NIS客户端的高级配置
时间:2009-03-23 来源:sjhf
NIS客户端高级配置
一般情况下,NIS的客户端只能在启动的时候将服务器上的共享目录挂载到本地,而不能在启动的时候同时启动NIS客户端程序,所以我们必须先以Root用户登录本地然后才可以登录NIS服务器。
可是我们不想这么麻烦,总希望在登录本地以前就可以登录到NIS服务器上去。怎么办呢?具体做法如下:
首先我假设在服务器上已经做好了一切配置(包括NFS服务的启动),同样也假设客户端上的配置已经基本完成(我指的是NFS客户端的启动挂载)
环境假定完毕,现在我们就可以直接进入正题啦!
首先在/usr/local/sbin目录下编写一个脚本,内容如下:
#!/bin/sh
service portmap restart
service ypbind start
将它保存并命名为NIS-client.sh
进入/etc/rc.d/init.d目录,编写如下脚本:
#!/bin/sh
# #NIS-client: Start/Stop the nis-client # #chkconfig: 35 99 01 # #Description: This scrip is use to start the nis-client when we start the computer. //注意这个脚本里的所有内容一行不能少,包括注释行也不能少! #Source function library . /etc/init.d/functions [ -f /usr/local/sbin/nis-client.sh ] || exit 0 #See how we called. case $1 in start) echo "Starting nis-client:" /usr/local/sbin/nis-client.sh echo "done" ;; stop) echo "Stopping nis-client:" killall -q -9 nis-client echo "done" ;; status) status nis-client ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: nis-client start|stop|status|reload|restart" exit 1 esac exit 0 将其保存命名为nis-client 在完成下面的操作: [root@localhost ~]#chmod 755 /usr/local/sbin/nis-client.sh [root@localhost ~]#chmod 755 /etc/rc.d/init.d/nis-client [root@localhost ~]#chkconfig -a nis-client [root@localhost ~]#init 6 然后就可以在启动后直接使用NIS服务器上的帐户登陆了,而不需先在本地登录开启NIS客户端程序ypbind。 |
相关阅读 更多 +