NIS +Autofs %沒有家目錄的問題, 要配合automont [root@server118 etc]# su - nismicky su: warning: cannot change directory to /home/nismicky: No such file or directory -bash-3.2$ Nis Server: Server1 (1)開啟nfs service (2)export : /rhome/station18 Nis Client: Server118 (1)設定autmount(/rhome/station18) (2)su - username時可以自動把家目錄mount起來 1.Nis Server: Server1 (1)設定nfs server並把export: /rhome/station18 [root@server1 /]# vi /etc/exports /var/ftp/pub/RHEL5 192.168.0.0/255.255.255.0(rw,sync,root_squash) /rhome/station18 192.168.0.0/255.255.255.0(rw,sync) [root@server1 /]# exportfs -rv exporting 192.168.0.0/255.255.255.0:/var/ftp/pub/RHEL5 exporting 192.168.0.0/255.255.255.0:/rhome/station18 (2)測試 [root@server1 /]# showmount -e localhost Export list for localhost: /rhome/station18 192.168.0.0/255.255.255.0 /var/ftp/pub/RHEL5 192.168.0.0/255.255.255.0 2.Nis Client: Server118 (1)設定automount [root@server118 etc]# vi /etc/auto.master ---略--- # For details of the format look at autofs(5). # /misc /etc/auto.misc /rhome/station18 /etc/auto.rhome # [root@server118 etc]# vi /etc/auto.rhome ---略--- * -fstype=nfs server1.example.com:/rhome/station18/& (2)測試 [root@server118 etc]# su - nisbob [karl@server118 ~]$ pwd /rhome/station18/nisbob [karl@server118 ~]$ mount ---略--- server1.example.com:/rhome/station18/nisbob on /rhome/station18/nisbob type nfs (rw,addr=192.168.0.254) %automount確實己經連到server1: /rhome/station18 %pwd路徑也是對的 /rhome/station18/nisbob %但是為什麼會出現karl [karl@server118 ~]$ id uid=502(karl) gid=502(may) groups=502(may) context=root:system_r:unconfined_t:SystemLow-SystemHigh %原來server1上的nisbob的uid=502, 對應到本機uid就變成karl (uid=502) %touch一個新檔, 可以寫入 [karl@server118 ~]$ touch karl.f1 %uid=502代表本機的[karl]及遠端的 [nisbob], 這樣情況除了會造成混亂 %若有心人士故意用nisbob的身份去砍karl的檔案....那就危險啦 %nisuser通常會避免跟主機有重覆的uid %或server118本機帳號 uid > 499 都移除, 只留系統帳號 [root@server118 etc]# su - nistom [nistom@server118 ~]$ pwd /rhome/station18/nistom [nistom@server118 ~]$ id uid=2001(nistom) gid=2001(nistom) groups=2001(nistom) context=root:system_r:unconfined_t:SystemLow-SystemHigh
文章標籤
全站熱搜
創作者介紹
創作者 aquatower 的頭像
aquatower

2006隨手札記

aquatower 發表在 痞客邦 留言(0) 人氣(438)