Chinaunix首页 | 论坛 | 博客
  • 博客访问: 300406
  • 博文数量: 82
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 490
  • 用 户 组: 普通用户
  • 注册时间: 2016-06-13 10:58
文章分类

全部博文(82)

文章存档

2018年(2)

2017年(9)

2016年(71)

我的朋友

分类: 嵌入式

2016-05-28 11:29:10

1.安装相关软件

yum install samba samba-client samba-commo 

chkconfig smb on 

chkconfig nmb on 


 

2.对路由表做如下操作

iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT 

iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT 

iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT 

service iptables save 

 

3.备份配置文件

在正式配置之前,对配置文件进行备份

cp /etc/samba/smb.conf /etc/samba/smb.conf.bak 

rm /etc/samba/smb.conf 

touch /etc/samba/smb.conf 

vi /etc/samba/smb.conf 

 

4.配置smb.conf ,并设置一个公开的目录Myshare

[global] 

workgroup = WORKGROUP 

security = share 

map to guest = bad user 

[MyShare] 

path = /home/samba/share 

valid users = aaron

browsable =yes 

writable = yes 

guest ok = yes 

read only = no 

 

5.设置文件夹权限,检测配置文件,重启服务,设置用户密码

chmod -R 0777 /home/samba/share 

testparm       # 测试配置

smbpasswd –a user    #注意,user是配置文件smb.conf中的valid users

 

6.如果出现无权限访问的问题,可以通过关闭防火墙以及selinux来尝试 

service smb restart

service nmb restart

service  iptables stop  

setenforce 0 

注意:可以在/etc/profile设置一个把上边启动命令添加,这样可以避免以后启动时在输入

  保存后输入#source /etc/profile,配置即可生效

 

7.添加网络映射时应该添加设置的分享文件名:如Myshare,之后键入刚才创建的smb用户名和密码即可。


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