我正在尝试配置Samba以共享公用文件夹 – 无需登录.我正在使用Fedora 16.
$smbd --version Version 3.6.1-74.fc16
配置:
[global] workgroup = WORKGROUP security = share hosts allow = 192.168. load printers = yes guest account = nobody log file = /var/log/samba/log.%m max log size = 50 domain master = no local master = yes os level = 35 null passwords = true username map = /etc/samba/smbusers name resolve order = hosts wins bcast dns proxy = no [test] comment = Pliki Estomedu path = /tmp/test/share public = yes writable = yes browseable = yes force user = nobody force group = nogroup create mask = 0777 directory mask = 0777 available = yes
路径:
ls -la /tmp/test/share/ total 8 drwxr-xr-x. 2 root root 4096 Nov 14 13:09 . drwxrwxrwx. 3 root root 4096 Nov 14 13:09 ..
smbusers:
# Unix_name = SMB_name1 SMB_name2 ... root = admin nobody = guest pcguest smbguest
我尝试连接时提供的内容(提供空密码):
$smbclient \\\\localhost\\test WARNING: The security=share option is deprecated Enter root's password: Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.1-74.fc16] Server not using user level security and no password supplied. smb: \> ls NT_STATUS_ACCESS_DENIED listing \*
请帮忙.从WinXP和Win7可以看到共享,但也获得访问被拒绝的消息.
解决方法
我发现了一个提醒:
SELinux is preventing /usr/sbin/smbd from read access on the directory share.
最好的解决方案是只允许共享所选目录:
/usr/sbin/semanage fcontext -a -t samba_share_t <path>
您还可以允许SAMBA共享所有目录:
setsebool -P samba_export_all_ro 1