samba启动失败:smb.service: main process exited, code=exited, status=1/FAILURE

记录一个今天遇到的问题,samba在启动的时候提示控制进程异常退出。
首先启动samba,然后命令行给了一条异常信息。

# systemctl start smb
Job for smb.service failed because the control process exited with error code. See “systemctl status smb.service” and “journalctl -xe” for details.

信息中给了两条指令来调用,先试试第一个

# systemctl status smb.service
smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2019-09-12 16:37:56 CST; 42s ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
Process: 7755 ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS (code=exited, status=1/FAILURE)
Main PID: 7755 (code=exited, status=1/FAILURE)
9月 12 16:37:49 localhost.localdomain systemd[1]: Starting Samba SMB Daemon…
9月 12 16:37:56 localhost.localdomain systemd[1]: smb.service: main process exited, code=exited, status=1/FAILURE
9月 12 16:37:56 localhost.localdomain systemd[1]: Failed to start Samba SMB Daemon.
9月 12 16:37:56 localhost.localdomain systemd[1]: Unit smb.service entered failed state.
9月 12 16:37:56 localhost.localdomain systemd[1]: smb.service failed.

内容大概是说,在启动samba的守护进程时失败了,具体原因也没有说。
现在我们试试第二条指令

#journalctl -xe

这次显示出来的东西就非常多,但是我们没必要一行一行去看,直接去找对我们有用的,既然是守护进程启动失败,samba的守护进程时smbd,和smbd相关的有一行颜色和其他的不太一样

SELinux is preventing /usr/sbin/smbd from read access on the file /etc/samba/smb.conf.

原因大概就是他了,selinux阻止了进程,我们现在吧selinux关掉试试。

#setenforce 0

再启动一遍samba

# systemctl restart smb

这次成功启动了,但这只是个临时解决的办法,为了以后能更方便一下,selinux永久关闭。

vim /etc/sysconfig/selinux

#SELINUX=enforcing
SELINUX=disabled

然后重启一遍系统,就可以了。

你可能感兴趣的:(Linux日常填坑)