我的最终目标是配置 HP Officejet Pro 8600 以将扫描保存到我计算机上的共享文件夹中(使用打印机的“扫描到网络文件夹”功能)。
因此,我通过以下方式将计算机上的一个文件夹配置为网络共享:
$ net usershare info --long
[LocalNetwork]
path=/path/to/LocalNetwork
comment=
usershare_acl=Everyone:F,
guest_ok=y
我还配置了我的 UFW 防火墙以允许从本地网络访问 Samba 使用的端口:
$ sudo ufw allow from 192.168.178.0/24 to any app Samba
Rule added
$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
137,138/udp (Samba) ALLOW IN 192.168.178.0/24
139,445/tcp (Samba) ALLOW IN 192.168.178.0/24
打印机和我的计算机都在同一个网络中,我\\<my-ip-address>\LocalNetwork
用作网络路径。由于打印机在测试连接时报告“连接失败”,我决定使用同一网络中的树莓派进行测试。但是,当我尝试挂载该文件夹时,它会要求root
用户输入密码:
$ sudo mount -t cifs //192.168.178.92/LocalNetwork test_mount_point
Password for root@//192.168.178.92/LocalNetwork:
我没想到会这样,因为我为访客配置了文件夹。那么为什么它会尝试进行身份验证,我如何将文件夹设置为无需身份验证即可访问?
编辑
通过传递-o guest
它不会提示输入密码,但是我得到一个mount error(13): Permission denied
:
$ sudo mount -t cifs -o guest //192.168.178.92/LocalNetwork test_mount_point
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
编辑
按照这个答案,我通过smbpasswd
一些密码(nopass
)添加了一个用户:
$ sudo smbpasswd -a nobody
当我尝试使用此用户名和密码安装文件夹时,我收到一个新错误:
$ sudo mount -v -t cifs -o user=nobody,password=nopass //192.168.178.92/LocalNetwork test_mount_point
mount error(5): Input/output error
编辑:testparm -s
这是输出:
$ testparm -s
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONE
# Global parameters
[global]
log file = /var/log/samba/log.%m
logging = file
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)
unix password sync = Yes
usershare allow guests = Yes
usershare owner only = No
idmap config * : backend = tdb
[LocalNetwork]
create mask = 0777
guest ok = Yes
path = /path/to/LocalNetwork
read only = No