当前位置:文档之家› CentOS安装samba服务配置匿名访问

CentOS安装samba服务配置匿名访问

CentOS安装samba服务配置匿名访问
时间:2014-04-16 00:33来源: 作者:lampblog 举报点击:1106次一、CentOS6.3安装samba服务
yum -y install smaba
二、编辑samba配置文件
vi /etc/samba/smb.conf
vi /etc/samba/smb.conf
1)更改用户组
workgroup = WORKGROUP
workgroup = WORKGROUP
2)授权可以访问的ip地址
hosts allow = 127. 192.168.1.
hosts allow = 127. 192.168.1.
3)设置共享方式
security = share
security = share
三种共享方式介绍
user 用户模式需要密码
share 匿名共享
server 比user级更高级的安全性
4)设置访问目录
[www]
comment = Document root directory
path = /var/www/html
public = yes
writable = yes
guest ok = yes //允许匿名访问,不设置则匿名无法访问
[www]
comment = Document root directory
path = /var/www/html
public = yes
writable = yes
guest ok = yes //允许匿名访问,不设置则匿名无法访问
三、配置防火墙策略
1.vi /etc/sysconfig/iptables
vi /etc/sysconfig/iptables
1)加入samba的端口
1.-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
2.-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -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
2)重启防火墙服务
service iptables restart
serviceiptables restart
附:
1)查看服务端口
netstat -anp | grep smb
1.[root@localhost ~]# netstat -anp | grep smb
2.tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 187
4/smbd
3.tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 187
4/smbd
4.tcp 0 0 :::139 :::* LISTEN 1874/s
mbd
5.tcp 0 0 :::445 :::* LISTEN 1874/s
mbd
6.unix 2 [ ] DGRAM 12440 1874/smbd
netstat -anp | grepsmb
[root@localhost ~]# netstat -anp | grepsmb
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1874/smbd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1874/smbd
tcp 0 0 :::139 :::* LISTEN 1874/smbd
tcp 0 0 :::445 :::* LISTEN 1874/smbd
unix 2 [ ] DGRAM 12440 1874/smbd
2)关闭selinux方法
1.[root@localhost ~]# sestatus
2.SELinux status: enabled
[root@localhost ~]# sestatus
SELinux status: enabled
[root@localhost ~]# vi /etc/sysconfig/selinux [root@localhost ~]# vi /etc/sysconfig/selinux
SELINUX=disabled改为
SELINUX=disabled
重启机器$reboot。

相关主题