windows 10 清除缓存共享的用户名和密码 cmd > net stop workstation
[root@localhost]mkdir -p /ABC/{ops,sales,share}
[root@localhost ABC]yum install samba -y
[root@localhost ABC]groupadd ops [root@localhost ABC]groupadd sales [root@localhost ABC]groupadd share
[root@localhost ABC]useradd -s /sbin/nologin ops [root@localhost ABC]useradd -s /sbin/nologin sales [root@localhost ABC]useradd -s /sbin/nologin share
[root@localhost ABC]#smbpasswd -a ops 123456 123456 [root@localhost ABC]#smbpasswd -a sales 123456 123456 [root@localhost ABC]#smbpasswd -a share 123456 123456
[root@localhost ABC]# chown ops:ops ops [root@localhost ABC]# chmod 770 ops [root@localhost ABC]# chown sales:sales sales [root@localhost ABC]# chmod 770 sales [root@localhost ABC]# chown share:share share [root@localhost ABC]# chmod 777 share
[root@localhost ABC]# systemctl restart smb
[root@localhost ABC]# cat /etc/samba/smb.conf
See smb.conf.example for a more detailed config file or
read the smb.conf manpage.
Run 'testparm' to verify the config is correct after
you modified it.
[global] workgroup = SAMBA security = user
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
[homes] comment = Home Directories valid users = %S, %D%w%S browseable = No read only = No inherit acls = Yes
[printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0600 browseable = No
[print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @printadmin root force group = @printadmin create mask = 0664 directory mask = 0775
#[common]
comment = Common share
path = /common
browseable = yes
writable = yes
#[smbtest]
comment = Common share
path = /smbtest
browseable = yes
writable = yes
[ops] comment = ops share path = /ABC/ops browseable = yes valid user = ops writable = yes guest ok = no write list = ops [sales] comment = sales share path = /ABC/sales browseable = yes valid user = sales writable = yes guest ok = no write list = sales [share] comment = share path = /ABC/share browseable = yes valid user = share writable = yes guest ok = yes write list = share
[root@localhost ABC]# ll 总用量 4 drwxrwx---+ 3 ops ops 140 9月 3 10:37 ops drwxrwx--- 4 sales sales 4096 8月 30 15:57 sales drwxrwxr-x 5 share share 160 8月 26 16:32 share
[root@localhost ABC]# getfacl ops
file: ops
owner: ops
group: ops
user::rwx group::rwx mask::rwx other::---
setfacl的作用和用法: 描述:设置文档访问控制列表 选项:-b #删除所有附加的ACL条目 -k #删除默认的ACL -m #添加ACL条目 -x #删除指定的ACL条目 -R #递归处理所有的子文件与子目录
[root@localhost ABC]#setfacl -m u:sales:rw ops
[root@localhost ABC]#getfacl ops
file: ops
owner: ops
group: ops
user::rwx user:sales:rw- group::rwx mask::rwx other::---
[root@localhost ABC]#setfacl -x u:sales ops