在Server上配置SMB服務vim
您的SMB服務器必須是STAFF工做組的一個成員服務器
共享/common目錄 共享名必須爲commonide
只有example.com域內的客戶端能夠訪問common共享雲計算
common必須是能夠瀏覽的spa
用戶andy必須可以讀取共享中的內容,若是須要的話,驗證密碼是redhatrest
[root@server ~]#yum install samba -yorm
[root@server ~]#firewall-cmd --add-service=sambaserver
[root@server ~]#firewall-cmd --add-service=samba --permanentci
[root@server ~]#firewall-cmd --add-service=mountdcmd
[root@server ~]#firewall-cmd --add-service=mountd --permanent
[root@server ~]#cd /etc/samba/
[root@server ~]#vim smb.conf
workgroup = STAFF
[root@server ~]#mkdir /common
[root@server ~]#chcon -R -t samba_share_t /common/
[root@server ~]#vim smb.conf
[common]
path = /common
hosts allow = 192.168.96.
browseable = yes
[root@server ~]#yum install samba-client -y
[root@server ~]#smbpasswd -a andy
[root@server ~]#systemctl start smb
[root@server ~]#systemctl enable smb
[root@client ~]#yum install samba-client cifs-* -y
[root@client ~]#smbclient -L /system1/ -U andy
[root@client ~]#smbclient //system1/common -U andy
在Server共享經過SMB目錄/mis知足如下要求:
共享名爲mis
共享目錄mis只能被example.com域中的客戶端使用
共享目錄mis 必須能夠被瀏覽
用戶silene必須能以讀的方式訪問共享,訪問密碼是redhat
用戶akira必須能以讀寫的方式訪問此共享,訪問密碼是redhat
此共享永久掛載在client.example.com上的/mnt/multi目錄。並使用用戶silene做爲認證 任何用戶能夠經過用戶akira來臨時獲取寫的權限
[root@server ~]#mkdir /mis
[root@server ~]#vim smb.conf
[mis]
path = /mis
hosts allow = 192.168.96.
browseable = yes
writable = no
write list = akira
[root@server ~]#chmod o+w /mis
[root@server ~]#smbpasswd -a silene
[root@server ~]#smbpasswd -a akira
[root@server ~]#chcon -R -t samba_share_t /mis
[root@server ~]#systemctl restart smb
[root@client ~]#mkdir /mnt/multi
[root@client ~]#smbclient -L /server.example.com/ -U silene
[root@client ~]#vim /etc/fstab
//server.example.com/mis/mnt/multicifsdefaults,multiuser,username=silene,password=redhat,sec=ntlmssp 0 0
[root@client ~]#mount -a
能夠嘗試切換到其它用戶
[root@client ~]#cifscreds add system1 -u akira
而後嘗試對/mnt/multi目錄進行寫操做