2014年10月20日 星期一

Solaris 11 NFS 設定

啟動NFS服務

# svcadm enable network/nfs/server

關閉NFS服務

# svcadm disable network/nfs/server

開啟automounter

# svcadm enable system/filesystem/autofs


檢查伺服器是否啟動NFS 服務

# svcs network/nfs/server


# svcs network/nfs/server
STATE          STIME    FMRI
disabled       18:03:46 svc:/network/nfs/server:default    目前狀態是關閉的


指令列mount 一個NFS
# mount -F nfs -o ro kitty:/export/home /mnt

Server端分享/export/home目錄給client,並僅有ro的權限
# share -F nfs -o ro=client  /export/home 

檢視目錄分享狀態
#cat /etc/dfs/sharetab
/export/home    export_home     nfs     sec=sys,ro=client


在Client端的vfstab加入一行,讓開機時自動mount起來
svcadm enable  network/nfs/client
server:/export/home     -       /mnt    nfs     0       yes      ro




======================================================================
關於Client Mount 沒有R/W權限

In fact, in this case root would be restricted - not by the target directories permissions but due to would be restricted, as share does not have "anon=0" or "root=<access list>" options - therefore the client's root user is "nobody" to the NFS server.

Server:
root@solaris:~# share -F nfs -o anon=0 /zpool/fs1
root@solaris:~# share
zpool_fs1       /zpool/fs1      nfs     anon=0,sec=sys,rw
root@solaris:~#

Client:
root@S11-ai-installed:/# mount -F nfs 192.168.1.222:/zpool/fs1 /a
可以成功寫入的

================= 分隔線 ===================================
限制由特定Client登入

Server
root@solaris:~# share -F nfs -o anon=0:root=192.168.1.110 /zpool/fs1
root@solaris:~# showmount -e
export list for solaris:
/zpool/fs1 (everyone)









沒有留言:

張貼留言