在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目录进行写操做