Fedora20下samba服务器配置

1.查看是否安装好samba服务器,如果没有使用即可。

[s_zyp@zhZyp ~]$ rpm -qa | grep samba
samba-libs-4.1.12-4.fc20.i686
samba-common-4.1.12-4.fc20.i686
samba-client-4.1.12-4.fc20.i686
samba-4.1.12-4.fc20.i686

  如果没安装,则使用下面指令安装

[s_zyp@zhZyp ~]$ sudo yum install -y samba

2.现在开始配置smb.conf文件

[s_zyp@zhZyp ~]$ cp /etc/samba/smb.conf /etc/samba/smb.conf.bak  ;备份
[s_zyp@zhZyp ~]$ sudo vim /etc/samba/smb.conf
;Global Setting
workgroup = WORKGROUP      ;自己Windows工作组
server string = Samba Server Version %v
netbios name = ZYP-PC      ;Windows主机名
;Standalone Server Options 
security = user            ;设置验证,注意share和server已废弃
passdb backend = tdbsam
[fedora]                   ;自定义共享文件
path = /tmp                ;文件路径
writeable = yes            ;可写
public = yes               ;允许共享

3. 手动添加一个samba用户(用户名必须是系统用户)

[s_zyp@zhZyp ~]$ sudo smbpasswd -a s_zyp
New SMB password:
Retype new SMB password:
Added user s_zyp.

4. 启动smb和nmb服务(配置修改后需要重启,reload貌似没用)

[s_zyp@zhZyp ~]$ sudo systemctl enable smb  ;设置开机启动
[s_zyp@zhZyp ~]$ sudo systemctl enable nmb  
[s_zyp@zhZyp ~]$ sudo systemctl start smb
[s_zyp@zhZyp ~]$ sudo systemctl start nmb

5. 现在可以在windows下输入linux的IP地址访问,如\\192.168.1.111。

遇到的问题与解决办法:

  a.无法访问Linux主机,首先确认是否能Ping通,如果可以,那可能是防火墙在作怪,把防火墙关了即可。

[s_zyp@zhZyp ~]$ sudo systemctl stop firewalld

  b.如果能进入,但没权限访问文件,则有两种可能,一是因为本身没有就读权限,那么使用chmod给other添加读权限即可;二可能是因为SElinux的原因,使用setenforce 0将其设置为permissive模式即可。

 参考:http://www.cnblogs.com/fklin/archive/2012/11/15/2772364.html

文章来自:http://zhangyanpei.blog.51cto.com/8964634/1560543
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3