samba用户权限控制

 

1. 安装及修改配置

yum -y install samba

[root@centos7 bszhihui]# 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
 #   username map = /etc/samba/smbusers

[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 = root
    create mask = 0664
    directory mask = 0775
#[bszhihui]
#    comment = bszhihui
#    path = /home/bszhihui
#    writable = yes    
#    public = yes
#    valid users = bszhihui

[bszhihui]
    comment = bszhihui
    path = /home/bszhihui
    #read only =yes
    public = no
    valid users = bszhihui,wuhuamin,allqa,,webrd,apprd,toolrd,allpro,@samba
    write list = bszhihui,wuhuamin,allqa,webrd,apprd,toolrd,allpro,@samba

  

2. 创建用户与配置文件中对应

useradd bszhihui

......

3. 将用户添加到samba用户数据库中并设置密码

smbpasswd -a bszhihui 

5,关闭selinux

setenforce 0

vim /etc/selinux/config

#   SELINUX=disabled

getsebool -a |grep samba

6关闭iptabales  (如开启需添加相应规则)

iptables -I RH-Firewall-1-INPUT 5 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT

iptables -I RH-Firewall-1-INPUT 5 -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

iptables -I RH-Firewall-1-INPUT 5 -p udp -m udp --dport 137 -j ACCEPT

iptables -I RH-Firewall-1-INPUT 5 -p udp -m udp --dport 138-j ACCEPT

iptables-save

service iptables  restart

systemctl start smb.service

systemctl start nmb.service

systemctl start nmb.service

systemctl enable nmb.service

windows登录测试 

用户名  

密码

用root登录后运行smbpasswd(在$SAMBA_PATH/bin)加用户名

猜你喜欢

转载自www.cnblogs.com/mingetty/p/11540549.html