需求:用户无密码登录,两个目录,一个用户只能查看,下载;另一个用户可以上传,下载
1、samba常用samba 配置文件位置
/etc/samba/smb.conf
启动
service smb restart|start|stop
查看samba状态
/usr/bin/smbstatus
检测配置语法
/usr/bin/testparm
开机启动
chkconfig smb on
2、配置不用用户名和密码的Samba共享
2.1 修改smb.conf文件;
在[global]部分加入:null passwords = yes
设置 security = share
取消 guest account = guest 的注释
建立[guest]段:
[guest]
comment = guest's share
path = /home/guest
public = yes
guest ok = yes
writable = yes
- #useradd guest
- #passwd guest
- #chmod 755 /home/guest
2.2 将guest加入smbpasswd文件中
例
- [global]
- workgroup = WORKGROUP
- server string = Samba Server Version %v
- null passwords = yes
- security = share
- passdb backend = tdbsam
- guest account = bu
- load printers = yes
- cups options = raw
- [homes]
- comment = Home Directories
- browseable = no
- writable = yes
- [printers]
- comment = All Printers
- path = /var/spool/samba
- browseable = no
- guest ok = no
- writable = no
- printable = yes
- [buzzshare]
- comment = Public Stuff
- path = /data/share
- public = yes
- writable = yes
- printable = no
- guest ok = no
- [everyshare]
- comment = Public Stuff
- path = /data/everyshare
- public = yes
- writable = yes
- printable = no
- create mode = 0775
- directory mode = 0775
3、有关samba的iptables规则
netfilter/iptables for samba
- iptables -A INPUT -i eth0 -p tcp -s 192.168.100.0/24 -m multiport --dport 139,445 -j ACCEPT
- iptables -A INPUT -i eth0 -p tcp -s 192.168.1.0/24 -m multiport --dport 139,445 -j ACCEPT
- iptables -A INPUT -i eth0 -p udp -s 192.168.100.0/24 -m multiport --dport 137,138 -j ACCEPT
- iptables -A INPUT -i eth0 -p udp -s 192.168.1.0/24 -m multiport --dport 137,138 -j ACCEPT
完
阅读(11679) | 评论(0) | 转发(0) |