您的位置:首页 > 运维架构 > Linux

Linux与云计算——第二阶段 第十章:Samba服务器架设—SMB共享目录及多用户SMB挂载

2016-08-10 14:06 609 查看

[b]Linux与云计算——第二阶段Linux服务器架设[/b]

第十章:Samba服务器架设—SMB共享目录及多用户SMB挂载

通过SMB共享目录

在Server上配置SMB服务您的SMB服务器必须是STAFF工作组的一个成员共享/common目录 共享名必须为common只有example.com域内的客户端可以访问common共享common必须是可以浏览的用户andy必须能够读取共享中的内容,如果需要的话,验证密码是redhat

[1] 安装配置Samba.

[root@server ~]#yum install samba -y[root@server ~]#firewall-cmd --add-service=samba[root@server ~]#firewall-cmd --add-service=samba --permanent[root@server ~]#firewall-cmd --add-service=mountd[root@server ~]#firewall-cmd --add-service=mountd --permanent[root@server ~]#cd /etc/samba/[root@server ~]#vim smb.confworkgroup = STAFF[root@server ~]#mkdir /common[root@server ~]#chcon -R -t samba_share_t /common/[root@server ~]#vim smb.conf[common] path = /commonhosts 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 = /mishosts allow = 192.168.96.browseable = yeswritable = nowrite 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目录进行写操作
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  SMB 通过 共享目录
相关文章推荐