⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0430nis.htm

📁 鸟哥LINUX 学习课本
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<br><font size="-1" color="#ffffff" face="SimSun">rpc.bynumber</font><br><font size="-1" color="#ffffff" face="SimSun">rpc.byname</font><br><font size="-1" color="#ffffff" face="SimSun">hosts.byaddr</font><br><font size="-1" color="#ffffff" face="SimSun">hosts.byname</font><br><font size="-1" color="#ffffff" face="SimSun">group.byname</font><br><font size="-1" color="#ffffff" face="SimSun">passwd.byname</font><br><font size="-1" color="#ffffff" face="SimSun">ypservers</font><br><font size="-1" color="#ffffff" face="SimSun">passwd.byuid</font></p><p><font size="-1" color="#ffffff" face="SimSun">Test 9: yp_all</font><br><font size="-1" color="#ffffff" face="SimSun">test test:dkoUW2XHV30sEV5gLM4NapyuhBcpVs.:500:500::/home/test:/bin/bash</font></p></td></tr></tbody></table>看到了吗?会有很多的资料一项一项的去测试,测试的结果都会显示在屏幕上面,最好都没有问题之后再开始NIS Client 的服务吧! ^_^<br> <br><hr width="100%"><a name="client_yp_tools_ypwhich"></a>ypwhich<table bgcolor="#000000" border="1" cols="1" width="550"><tbody><tr><td><font size="-1" face="SimSun"><font color="#ffffff">[root@clientroot]# </font><font color="#ffff00">ypwhich</font></font><br><font size="-1" color="#ffffff" face="SimSun">server.cluster</font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@clentroot]# </font><font color="#ffff00">ypwhich -x</font></font><br><font size="-1" color="#ffffff" face="SimSun">Use "ethers"&#160;&#160;&#160;for map "ethers.byname"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "aliases"&#160;&#160;for map "mail.aliases"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "services"&#160;for map "services.byname"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "protocols"for map "protocols.bynumber"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "hosts"&#160;&#160;&#160;&#160;for map "hosts.byname"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "networks"&#160;for map "networks.byaddr"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "group"&#160;&#160;&#160;&#160;for map "group.byname"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "passwd"&#160;&#160;&#160;for map "passwd.byname"</font></td></tr></tbody></table>单纯使用 ypwhich 的时候显示的是『<font color="#000066">NIS Client 的 domain</font>』名称,而当加入-x 这个参数时,则是显示『<font color="#000066">NIS Client 与 Server 之间沟通的数据库有哪些?</font>』由上面我们可以很清楚的就看到相关的档案啦!这些数据库档案则是放置在我的NIS Server 的 /var/yp/cluster/* 里面啰!<br> <br><hr width="100%"><a name="client_yp_tools_ypcat"></a>ypcat<table bgcolor="#000000" border="1" cols="1" width="550"><tbody><tr><td><font size="-1" face="SimSun"><font color="#ffffff">[root@clientroot]# </font><font color="#ffff00">ypcat -x</font></font><br><font size="-1" color="#ffffff" face="SimSun">Use "ethers"&#160;&#160;&#160;for map "ethers.byname"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "aliases"&#160;&#160;for map "mail.aliases"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "services"&#160;for map "services.byname"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "protocols"for map "protocols.bynumber"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "hosts"&#160;&#160;&#160;&#160;for map "hosts.byname"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "networks"&#160;for map "networks.byaddr"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "group"&#160;&#160;&#160;&#160;for map "group.byname"</font><br><font size="-1" color="#ffffff" face="SimSun">Use "passwd"&#160;&#160;&#160;for map "passwd.byname"</font><br><font size="-1" color="#ff6666" face="SimSun"># 主要的功能就是『列出数据库』啰!与ypwhich -x 相同功能!</font><br><font size="-1" color="#ff6666" face="SimSun"># 所以我们有ethers, aliases......passwd 等数据库名称与文件名!</font><br><font size="-1" color="#ffffff" face="SimSun"> </font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@clientroot]#</font><font color="#ffff00"> ypcat [数据库名称或功能]</font></font><br><font size="-1" color="#ff6666" face="SimSun"># 这个指令可以用来取得NIS Server 上面各个数据库的内容!</font><br><font size="-1" color="#ff6666" face="SimSun"># 举例来说,我们想要知道passwd ( 密码数据 ) 的所有使用者内容,就需要:</font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@clientroot]#</font><font color="#ffff00"> ypcat passwd&#160; (或 ypcat passwd.byname)</font></font><br><font size="-1" color="#ffffff" face="SimSun">test:dkoUW2XHV30sEV5gLM4NapyuhBcpVs.:500:500::/home/test:/bin/bash</font><br><font size="-1" color="#ff6666" face="SimSun"># 如果是想要知道hosts 的内容 (NIS Server 主机上面 /etc/hosts 的内容):</font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@clientroot]#</font><font color="#ffff00"> ypcat hosts</font></font><br><font size="-1" color="#ffffff" face="SimSun">127.0.0.1&#160;&#160;&#160;&#160;&#160;&#160;localhost&#160;&#160;&#160;&#160;&#160;&#160; localhost.localdomain</font><br><font size="-1" color="#ffffff" face="SimSun">192.168.10.30&#160;&#160;server.cluster</font><br><font size="-1" color="#ff6666" face="SimSun"># 反正就是加上数据库,你就可以取得NIS server 主机上面的数据库内容啦!</font></td></tr></tbody></table>&nbsp;</ul>这三个指令在进行 NIS Client 端的检验时,是相当有用的喔!不要忽略了他的存在啊!尤其是刚架设好NIS Client 时,一定要使用 yptest 去检查看看有没有设定错误喔!根据屏幕显示的讯息去一个一个校正错误才行啊!<br> <br><hr width="100%"><a name="client_yp_tools_2"></a>	<font size="+1" color="#000099">修改使用者密码( 需要有 root 身份 ): yppasswd, ypchfn, ypchsh</font><br> <br>好了,既然 NIS Client 已经可以正式的来 run 了,那么还可能有什么大问题呢!?最大的问题在于....<font color="#000066">我能不能在NIS Client 端修改各个账号的密码呢</font>?答案是『能!』但是不怎么方便~因为,我们要修改的是NIS Server 端的数据库喔!也就是说,我们在 NIS Client 端登入之后,要修改自己这个账号的密码,其实改到的是NIS Server 的数据库密码啊!而要修改数据库密码时,需要使用 root 的身份,所以一定需要root 的密码~如此一来,实在是不太方便~如果真的要修改的话,那么可以使用底下三个小指令来进行修改,不过,不怎么建议这样做就是了!<br> <ul><li><font color="#000066" face="SimSun">yppasswd :与 passwd 指令相同功能;</font></li><li><font color="#000066" face="SimSun">ypchfn&#160;&#160; :与 chfn相同功能;</font></li><li><font color="#000066" face="SimSun">ypchsh&#160;&#160; :与 chsh相同功能。</font></li></ul> <br>无论如何,我是不太建议大家使用这些指令去修改数据库的内容啦!比较建议这样做:<br> <ol><li><font color="#000066">登入到 NIS Server 主机里面去,进行 useradd 或者是passwd 修改账号与密码等等的更动;</font></li><li><font color="#000066">使用 /usr/lib/yp/ypinit -m 重新制作数据库档案!</font></li></ol> <br>这样就 OK 啦!比较简单啦我想~至于上面三个指令,请使用 Linux 的好朋友man 来查看一下吧! ^_^</ul><hr width="100%"><a name="serverahead"></a><font size="+1" color="#000099">主机进阶设定</font><ul><li><a name="serverahead_nis_nfs"></a><font size="+1" color="#000099">NIS与 NFS 的结合设定:</font></li><br> <br>不晓得您有没有发现一件事情啊!那就是:我们的 NIS Server 设定的使用者家目录是在/home 底下,例如 test 这个人的家目录在 /home/test (这个目录在 server.cluster这部主机上面才有),问题是,当我们登入 NIS Client 主机时,那么我们取得的家目录数据还是在/home/test ,问题是,NIS Client 主机并没有 /home/test 这个目录啊:<br> <ul><li><font color="#000066">test 这个 User 是在 server 上面建立的,所以有 /home/test这个目录;</font></li><li><font color="#000066">在 NIS Client 上面没有真正的 test 这个账号,因为他是由NIS server 上面取得的,所以自然也就没有 /home/test 这个目录在 NIS client上面。</font></li></ul> <br>这样会造成什么问题呢?呵呵!就是你的 test 这个使用者,登入 NIS client的时候,『<font color="#000066">会找不到自己的家目录</font>』!啊!真是糟糕~而且,因为我们的NIS client 可能有很多部,要是每次登入 NIS Clients 主机的时候,所拥有的家目录都是个别NIS client 上面的目录,那么就没有达到 NIS 的功能啦!您说是吧!所以,如果你需要『<font color="#000066">登入的每个NIS Client 所拥有的家目录都是相同的</font>!』的一个情况,呵呵!就可以使用NFS 来加以设定啦!详细的 NFS 设定我们之前已经提过了,这里不在赘言,单纯谈一下简单的设定技巧:<br> <ul><li><font color="#000066">在 NIS Server 上面开放 /home 这个目录出来;</font></li><li><font color="#000066">在 NIS Client 上面, mount NIS 主机的 /home 到自己的/home 里面去!</font></li><li><font color="#000066">如此一来,不论登入哪一部 NIS Server 或 client ,使用者都是进入到NIS Server 的 /home 里面的家目录啰!</font></li></ul> <br>设定的方法也不难,我们就简单的谈一谈吧!<br> <table bgcolor="#000000" border="1" cols="1" width="550"><tbody><tr><td><font size="-1" color="#ffffcc" face="SimSun">1. 设定 NISServer 主机的 NFS 开放目录:</font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">vi /etc/exports</font></font><br><font size="-1" color="#ffff00" face="SimSun">/home&#160;192.168.10.0/24(rw,async,no_root_squash)</font><br><font size="-1" color="#ffffff" face="SimSun"> </font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]#</font><font color="#ffff00"> exportfs -rv</font></font><br><font size="-1" color="#ffffff" face="SimSun">exporting 192.168.10.0/24:/home</font><br><font size="-1" color="#ffffff" face="SimSun"> </font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]# </font><font color="#ffff00">/etc/rc.d/init.d/nfs start</font></font><br><font size="-1" color="#ffffff" face="SimSun">Starting NFSservices:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;[&#160; OK&#160; ]</font><br><font size="-1" color="#ffffff" face="SimSun">Starting NFSquotas:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;[&#160; OK&#160; ]</font><br><font size="-1" color="#ffffff" face="SimSun">Starting NFSdaemon:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;[&#160; OK&#160; ]</font><br><font size="-1" color="#ffffff" face="SimSun">Starting NFSmountd:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;[&#160; OK&#160; ]</font><br><font size="-1" color="#ffffff" face="SimSun"> </font><br><font size="-1" face="SimSun"><font color="#ffffff">[root@testroot]#</font><font color="#ffff00"> chkconfig --level 35 nfs on</font></font><br><font size="-1" color="#ffffff" face="SimSun"> </font><br><font size="-1" color="#ffffcc" face="SimSun">2. 设定 NISClient 的 mount 资料!</font><br><font size="-1" color="#ff6666" face="SimSun"># 先以 root的身份登入到 NIS Client 主机上面:</font><br><font size="-1" face="SimSun"><f

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -