centOS 7 部署samba

部署samba

**每个用户有自己的目录,可以浏览内容,也可以删除**

清空防火墙规则

[root@bogon ~]# iptables -F

安装samba

[root@bogon ~]# yum -y install samba

配置文件在/etc/samba/smb.conf

添加用户

[root@bogon samba]# useradd smbtest
[root@bogon samba]# usermod -s /sbin/nologin smbtest
[root@bogon samba]# smbpasswd -a smbtest
New SMB password:
Retype new SMB password:
Added user smbtest.

重启服务测试连接

[root@bogon samba]# systemctl restart smb

smb删除用户用以下命令:

smbpasswd -x smbtest

**所有的用户共享一个目录,只能浏览内容,不能删**

新建share目录,修改权限

[root@bogon samba]# mkdir /share
[root@bogon samba]# ll /share -d
drwxr-xr-x 2 root root 6 6月 1 00:53 /share
[root@bogon samba]# chmod o+w /share
[root@bogon samba]# ll -d /share
drwxr-xrwx 2 root root 6 6月 1 00:53 /share

修改配置,重启服务

[root@bogon samba]# vim smb.conf
[public]
comment = Public Stuff
path = /share
public = yes
writable = no
printable = no
write list = lucaq,lucaqsmb,smbtest

[root@bogon samba]# systemctl restart smb

windows下测试:

net use
net use * /del
\192.168.16.99public
原文地址:https://www.cnblogs.com/lucaq/p/6925480.html