保证samba已正常安装的情况下,使用SU root权限 testparm检查samba的配置文档是否符合规范,由于我这里使用的是出品公司已经配置好的系统,只是samba服务一直启动失败,已经确认配置文件正常,所以使用smbd -F -S命令根据提示配置去一层层的用 chmod -R 权限 目录,更改相关目录权限即可。
一:精简命令
- 服务管理器打开samba并重启服务器
- 执行以下命令
chmod -R 0755 /var/lib/samba/; chmod -R 0700 /var/lib/samba/private/msg.sock; chmod -R 0700 /var/run/samba/ncalrpc/np
二:解决过程
记录下解决过程
#/evideoktv/sh/start_samba.sh
Starting smb service:FAIL
#smbd -F -S
smbd version 4.6.6 started.
Copyright And rew Tridgell and Samba Team 1992-2017
invalid permissions on directory '/var/lib/samba/private/msg.sock':has 0777should be 070
#chmod -R 0700 /var/lib/samba/private/msg.sock
#smbd -F -S
smbd version 4.6.6 started.
Copyright And rew Tridgell and Samba Team 1992-2017
invalid permissions on directory '/var/run/samba/ncalrpc/np':has 0777should be 0700
Failed to create pipe directory /var/run/samba/ncalrpc/np -No such file or directory
#chmod -R 0700 /var/run/samba/ncalrpc/np
#smbd -F -S
smbd version 4.6.6 started.
Copyright And rew Tridgell and Samba Team 1992-2017
STATUS=daemon 'smbd' finished starting up and ready to serve connections
以上到最后已经提示成功,但在windows服务器//Linux系统IP时 发现还是无法访问
确认无问题后,测试下配置文档能不能跑得通
#su root /etc/init.d/S91smb.stop
Shutting down SMB services:OK
shutting down NMB services: sh:you need to specify whor kill
FAIL
#testparm /etc/samba/smb.conf
..............
..............
WARNING:......................
WARNING:state directory /var/lib/samba should have permissions 0755 for browsing to work
...................
.................
#chmod -R 0755 /var/lib/samba/
本以为这下启动可以成功了,试了一下,比之前情况要糟糕,启动服务直接两个FAIL,返回去smdb了下权限,原来是这次把samba及子目录权限又设置为0755了
#su root /etc/ini.d/S91smb start
Starting SMB services:FAIL
Starting NMB services:FAIL
#smbd -F -S
smbd version 4.6.6 started.
Copyright And rew Tridgell and Samba Team 1992-2017
invalid permissions on directory '/var/lib/samba/private/msg.sock':has 0755should be 0700
#