我跟着本教程在运行 Arch 的 Raspberry Pi 上设置 Samba。
我的 smb.conf 如下:
[global]
server string = Samba Server
workgroup = MYGROUP
log file = /var/log/samba/%m.log
max log size = 50
printcap name = /etc/printcap
name resolve order = lmhosts wins bcast host
security = USER
dns proxy = No
idmap config * : backend = tdb
[homes]
comment = Home Directories
browseable = No
read only = No
[printers]
comment = All Printers
path = /var/spool/samba
browseable = No
printable = Yes
[Test]
comment = Test Folder
path = /media/USB8GB/shares
create mask = 0660
directory mask = 0771
force group = users
read only = No
valid users = @users
首先,它不会出现在 Windows 10 中。但是,当尝试手动连接到\\ALARMPI\Test
或 时\\192.168.1.4\Test
,它确实识别服务器,但我无法使用我创建的用户登录。我得到connection refused
。
smbclient -L ALARMPI
但是 SSH 确实有效。
我有许多日志文件:
192.168.1.2.log alarmpi.log desktop-sf05bvt.log fe80__ba27_xxxx_xxxx_ce6f.log log.smbd smbd.log
192.168.1.4.log cores fe80__8405_xxxx_xxxx_b470.log log.nmbd nmbd.log
然而只有 nmbd.log 和 smbd.log 包含内容。nmbd.log:
[2017/04/03 00:53:57.475291, 0] ../source3/nmbd/nmbd.c:58(terminate)
Got SIGTERM: going down...
[2017/04/03 00:54:03.469717, 0] ../lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon 'nmbd' finished starting up and ready to serve connections
[2017/04/03 00:54:53.502419, 0] ../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
*****
Samba name server ALARMPI is now a local master browser for workgroup MYGROUP on subnet 192.168.1.4
*****
在我重启电脑的过程中,出现了几行类似的内容
。smbd.log
[2017/04/03 00:39:19.588558, 0] ../lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon 'smbd' finished starting up and ready to serve connections
[2017/04/03 00:39:19.673462, 0] ../source3/printing/print_standard.c:71(std_pcap_cache_reload)
Unable to open printcap file /etc/printcap for read!
[2017/04/03 00:52:12.043798, 0] ../source3/printing/print_standard.c:71(std_pcap_cache_reload)
Unable to open printcap file /etc/printcap for read!
[2017/04/03 00:54:06.779226, 0] ../lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon 'smbd' finished starting up and ready to serve connections
[2017/04/03 00:54:06.873653, 0] ../source3/printing/print_standard.c:71(std_pcap_cache_reload)
Unable to open printcap file /etc/printcap for read!
[2017/04/03 01:07:05.831166, 0] ../source3/printing/print_standard.c:71(std_pcap_cache_reload)
Unable to open printcap file /etc/printcap for read!
类似这样的句子还有好几行。
它甚至没有提及我尝试从 Windows 登录的任何信息。
我希望有人能帮我解决这个问题,我用谷歌搜索只找到了一些看似不相关的问题和/或没有帮助的解决方案。
如果您需要任何其他信息,我很乐意为您提供。
答案1
我尝试了几种方法,终于成功了。Arch wiki 上的 Samba 似乎遗漏了一些重要信息,就像我使用的其他教程一样。
确保将用户添加到 samba 后启用该用户:smbpasswd -L -e username
如果您在共享中指定了相应组,请确保将用户添加到相应组:
usermod -a -G groupname username
您还应确保在共享文件夹上设置正确的权限,以便该组对该文件夹具有权限。
设置位是个好主意setgid
。在我的例子中,我将组设置为,users
将权限设置为2770
。
最后,我还将[Test]
smb.conf 中的定义更改为以下内容:
[Test]
comment = Test Folder
path = /media/USB8GB/shares
create mask = 0660
directory mask = 2770
force create mode = 0660
force directory mode = 2770
force group = users
read only = No
valid users = @users