我正在尝试配置 Samba 以共享公共文件夹 - 无需登录。我使用的是 Fedora 16。
$ smbd --version
Version 3.6.1-74.fc16
Run Code Online (Sandbox Code Playgroud)
配置:
[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
Run Code Online (Sandbox Code Playgroud)
小路:
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 ..
Run Code Online (Sandbox Code Playgroud)
用户:
# Unix_name = SMB_name1 SMB_name2 ...
root = admin
nobody = guest pcguest smbguest
Run Code Online (Sandbox Code Playgroud)
我尝试连接时得到的结果(提供空密码):
$ 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 \*
Run Code Online (Sandbox Code Playgroud)
请帮忙。该共享在 WinXP 和 Win7 中可见,但也会收到拒绝访问消息。
我发现了一个警报:
SELinux is preventing /usr/sbin/smbd from read access on the directory share.
Run Code Online (Sandbox Code Playgroud)
最好的解决方案是只允许共享选定的目录:
/usr/sbin/semanage fcontext -a -t samba_share_t <path>
Run Code Online (Sandbox Code Playgroud)
您还可以允许 SAMBA 共享所有目录:
setsebool -P samba_export_all_ro 1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9053 次 |
| 最近记录: |