win10在同一个局域网中,前几天正常使用,不记得修改了smbd的文件,但是突然无法访问ubuntu共享的文件夹,win10检查之后,报错说可能远程文件夹的smbd服务没有启动;我使用如下命令尝试重新启动smbd
sudo service smbd restart
输出
Job for smbd.service failed because the control process exited with error code.See "systemctl status smbd.service" and "journalctl -xe" for details.
推荐使用下面命令来进行具体排查
sudo smbd -iS#或者sudo smbd -FS
我的输出报错:
smbd version 4.7.6-Ubuntu started.Copyright Andrew Tridgell and the Samba Team 1992-invalid permissions on directory '/var/lib/samba/private/msg.sock': has 0755 should be 0700
说明不知道怎么回事,有个权限不对,按照输出的指示做一下修改:
sudo chmod 0700 /var/lib/samba/private/msg.sock
再次重启动smbd
,但是错误依旧
sudo service smbd restart
再次使用sudo smbd -iS
smbd version 4.7.6-Ubuntu started.Copyright Andrew Tridgell and the Samba Team 1992-tdb(/var/lib/samba/registry.tdb): tdb_rec_read bad magic 0x0 at offset=525988tdb(/var/lib/samba/registry.tdb): tdb_rec_read bad magic 0x0 at offset=525988tdb(/var/lib/samba/registry.tdb): tdb_rec_read bad magic 0x0 at offset=525988tdb(/var/lib/samba/registry.tdb): tdb_rec_read bad magic 0x0 at offset=525988tdb(/var/lib/samba/registry.tdb): tdb_rec_read bad magic 0x0 at offset=525988tdb(/var/lib/samba/registry.tdb): tdb_rec_read bad magic 0x0 at offset=525988tdb(/var/lib/samba/registry.tdb): tdb_rec_read bad magic 0x0 at offset=525988regdb_store_keys: Failed to store new record for key [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Group Policy]: WERR_GEN_FAILUREFailed to initialize data in registry!STATUS=daemon failed to start: Samba cannot init registry, error code 13
尝试删除/var/lib/samba/registry.tdb
sudo rm /var/lib/samba/registry.tdb
最后再次启动smbd成功!
如果觉得《win10无法访问ubuntu共享文件夹(smbd出错排查)》对你有帮助,请点赞、收藏,并留下你的观点哦!