我已下定决心并安装了 ubuntu,希望能够设置一个用于共享音乐文件和运行种子的服务器。
我也安装了 Samba,虽然我可以从我的 Windows 10 笔记本电脑上看到文件,但我无法访问共享文件。
Testparm 看起来像这样
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Torrents]"
Processing section "[Down]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
# Global parameters
[global]
dns proxy = No
log file = /var/log/samba/log.%m
map to guest = Bad User
max log size = 1000
obey pam restrictions = Yes
pam password change = Yes
panic action = /usr/share/samba/panic-action %d
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
passwd program = /usr/bin/passwd %u
server role = standalone server
server string = %h server (Samba, Ubuntu)
syslog = 0
unix password sync = Yes
usershare allow guests = Yes
idmap config * : backend = tdb
[printers]
browseable = No
comment = All Printers
create mask = 0700
path = /var/spool/samba
printable = Yes
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
[Down]
comment = Torrent folder
create mask = 0666
directory mask = 0777
force create mode = 0666
force directory mode = 0777
guest ok = Yes
path = /media/peter/Torrents/down
read only = No
Windows 上的错误显示
“Windows 无法访问”。我尝试了姓名和地址,但得到的都是相同的错误消息。
有什么指点吗?
谢谢
答案1
这不是 Samba 问题。这是 Linux 权限问题。
路径 = /media/peter/Torrents/down
Linux 创建 /media/peter 目录的方式限制了只有 peter 才能访问该目录,其他任何人都不能访问。来宾用户不是 peter,因此它永远不会到达路径的 /Torrents/down 部分。一种解决方案是,通过在force user = peter
共享定义中添加以下内容,让来宾用户看起来就是您:
[Down] comment = Torrent folder create mask = 0666 directory mask = 0777 force create mode = 0666 force directory mode = 0777 guest ok = Yes path = /media/peter/Torrents/down force user = peter read only = No
然后重新启动smbd:sudo service smbd restart