Samba服务器配置

zousongshan 2012-12-11

1、通过Yum安装Samba

2、在Service中设置为自启动

3、在firewall中放开Samba需要的端口,编辑 /etc/sysconfig/iptables,在里面加入:

-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

 
4、将seLinux关闭,修改/etc/selinux/config,将SELINUX= setenforce 改为 SELINUX = disabled

5、配置/etc/samba/smb.conf

workgroup = Workgroup
server string = Samba Server Version %v

netbios name = LCSambaSrv

;	interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24 
hosts allow = 10.


security = user
passdb backend = tdbsam

[km]
browseable = no
comment = private for km
path = /data/ftp/km
valid users = km
public = no
writable = yes
printable = no
guest ok = no
create mask = 0775
directory mask = 0775

 

6、创建用户

useradd km -d /data/ftp/km -s /bin/false
smbpasswd -a km

 

7、重新启动samba

/etc/init.d/smb restart

 如何启动匿名账户:

(1)修改smb.conf

security = user
map to guest = bad user     #这个是添加的

#共享目录设置
[shareDoc]
browseable = yes
comment = share docs
path = /data/shareDocs
public = yes
writable = yes
write list = guest
printable = no
guest ok = yes
create mask = 0755
directory mask = 0755

相关推荐