首页 > 其他 > 详细

samba用户权限控制

时间:2019-09-23 17:49:54      阅读:179      评论:0      收藏:0      [点我收藏+]

 

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)加用户名

 

samba用户权限控制

原文:https://www.cnblogs.com/mingetty/p/11540549.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!