我整天尝试从 Windows 7 笔记本电脑连接到 Raspbian 上的 Samba 服务器。
首先,我有一台 Windows 7家庭版读了一些文章后,我觉得这一点很重要,因为我想知道是否可以将该版本与 Samba 一起使用。还要注意,在这个 Windows 7 上,我有一个能够连接到 Samba 的 Debian VM,呵呵。
我已经阅读了很多文章和解决方案,所以我认为这并不简单并且值得在这里提出一个问题,但我对 Samba 也是新手,我可能会错过一些愚蠢的东西。
Samba 配置文件
[global]
workgroup = WORKGROUP
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
[homes]
comment = Home Directories
browseable = no
read only = yes
create mask = 0700
directory mask = 0700
valid users = %S
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
[share]
Comment = Pi shared folder
Path = /home/pi/sync_images
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes
[global]
workgroup = WORKGROUP
netbios name = LINUXSERVER
lanman auth = no
ntlm auth = yes
client lanman auth = no
wins support = yes
local master = yes
preferred master = yes
Samba 用户配置文件
$ sudo pdbedit -L -v
Unix username: pi
NT username:
Account Flags: [U ]
User SID: S-1-5-21-940656554-1247367340-895234526-1000
Primary Group SID: S-1-5-21-940656554-1247367340-895234526-513
Full Name:
Home Directory: \\linuxserver\pi
HomeDir Drive:
Logon Script:
Profile Path: \\linuxserver\pi\profile
Domain: RASPBERRYPI
Account desc:
Workstations:
Munged dial:
Logon time: 0
Logoff time: never
Kickoff time: never
Password last set: ven., 04 mai 2018 17:53:14 CEST
Password can change: ven., 04 mai 2018 17:53:14 CEST
Password must change: never
Last bad password : 0
Bad password count : 0
Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
我从我的 Win 7 进行的连接测试
net use X: \\RASPBERRYPI\share /USER:pi ********* *no hit*
net use X: \\LINUXSERVER\share /USER:pi ********* *no hit*
net use X: \\linuxserver\share /USER:pi ********* *no hit*
net use X: \\RASPBERRYPI\share /USER:WORKGROUP\pi ********* *no hit*
net use X: \\LINUXSERVER\share /USER:WORKGROUP\pi ********* *no hit*
net use X: \\linuxserver\share /USER:WORKGROUP\pi ********* *no hit*
每次我都会收到 53 错误。
regedit
修改
我还尝试了regedit
关于 Windows 7 和 Samba 的旧解决方案。基本上就是:创建一个 DWORD 键
HKLM\SYSTEM\CurrentControlSet\Control\Lsa/LmCompatibilityLevel
将其设置为 2。重新启动,无效。
从 0变为HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\everyoneincludesanonymous
1
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\NoLmHash
从 1 到 0
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters\restrictnullsessaccess
从 1 到 0
重启,未命中
问题
知道我能做什么吗?另外,您是否知道是否存在 Windows Samba 客户端的替代方案并且可以安装?我的目标是使用 Python 将 Raspberry Pi 上的某些文件夹同步到 Windows 7。
答案1
如果您想在 PI 和 Windows 之间同步文件夹,您可以在 Windows 系统上安装一个 SCP 服务器,如 Windows 的 OpenSSH(免费)或 Bitvise SSH 服务器(可能不免费;不确定),然后使用从 Python 调用的 Linux 机器上的常见 SCP 命令从您的 Linux 机器(您的 PI)复制文件。