Chinaunix首页 | 论坛 | 博客
  • 博客访问: 139128
  • 博文数量: 8
  • 博客积分: 666
  • 博客等级: 上士
  • 技术积分: 115
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-30 22:46
文章分类
文章存档

2012年(5)

2011年(3)

我的朋友

分类: LINUX

2012-04-17 19:33:07

  需求:用户无密码登录,两个目录,一个用户只能查看,下载;另一个用户可以上传,下载

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段

[guest]
comment = guest's share 
path = /home/guest
public = yes
guest ok = yes
writable = yes

修改权限

  1. #useradd guest
  2. #passwd guest
  3. #chmod 755 /home/guest

 2.2 将guest加入smbpasswd文件中
 

guest设置为无密码

#smbpasswd -a guest 
#smbpasswd -n guest


SMB.CONF

  1. [global]
  2.     workgroup = WORKGROUP
  3.     server string = Samba Server Version %v
  4.         null passwords = yes
  5.     security = share
  6.     passdb backend = tdbsam
  7.         guest account = bu
  8.     load printers = yes
  9.     cups options = raw
  10. [homes]
  11.     comment = Home Directories
  12.     browseable = no
  13.     writable = yes
  14. [printers]
  15.     comment = All Printers
  16.     path = /var/spool/samba
  17.     browseable = no
  18.     guest ok = no
  19.     writable = no
  20.     printable = yes
  21. [buzzshare]
  22.     comment = Public Stuff
  23.     path = /data/share
  24.     public = yes
  25.     writable = yes
  26.     printable = no
  27.     guest ok = no
  28. [everyshare]
  29.     comment = Public Stuff
  30.     path = /data/everyshare
  31.     public = yes
  32.     writable = yes
  33.     printable = no
  34.         create mode = 0775
  35.         directory mode = 0775

添加用户可以读写的目录  设置新段,并赋予权限即可

3、有关samba的iptables规则

netfilter/iptables for samba

  1. iptables -A INPUT -i eth0 -p tcp -s 192.168.100.0/24 -m multiport --dport 139,445 -j ACCEPT
  2. iptables -A INPUT -i eth0 -p tcp -s 192.168.1.0/24 -m multiport --dport 139,445 -j ACCEPT
  3. iptables -A INPUT -i eth0 -p udp -s 192.168.100.0/24 -m multiport --dport 137,138 -j ACCEPT
  4. iptables -A INPUT -i eth0 -p udp -s 192.168.1.0/24 -m multiport --dport 137,138 -j ACCEPT



阅读(11701) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~