Linux與雲計算——第二階段 第十章:Samba服務器架設—SMB共享目錄及多用戶SMB掛載

Linux與雲計算——第二階段Linux服務器架設

第十章:Samba服務器架設—SMB共享目錄及多用戶SMB掛載

經過SMB共享目錄

Server上配置SMB服務vim

您的SMB服務器必須是STAFF工做組的一個成員服務器

共享/common目錄 共享名必須爲commonide

只有example.com域內的客戶端能夠訪問common共享雲計算

common必須是能夠瀏覽的spa

用戶andy必須可以讀取共享中的內容,若是須要的話,驗證密碼是redhatrest

[1] 安裝配置Samba.

[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

[2] 客戶機上

[root@client ~]#yum install samba-client cifs-* -y

[root@client ~]#smbclient -L /system1/ -U andy

[root@client ~]#smbclient //system1/common -U andy

配置多用戶SMB掛載

Server共享經過SMB目錄/mis知足如下要求:

共享名爲mis

共享目錄mis只能被example.com域中的客戶端使用

共享目錄mis 必須能夠被瀏覽

 用戶silene必須能以讀的方式訪問共享,訪問密碼是redhat

用戶akira必須能以讀寫的方式訪問此共享,訪問密碼是redhat

此共享永久掛載在client.example.com上的/mnt/multi目錄。並使用用戶silene做爲認證 任何用戶能夠經過用戶akira來臨時獲取寫的權限

[1] 服務器端配置

[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

[2] 客戶端配置

[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目錄進行寫操做

相關文章
相關標籤/搜索