CentOS 7 / RHEL 7 : Unable To Start The Samba Service

The SMB service is unable to start, SAMBA shares can’t be accessed. Using systemctl fails to start the service and below is the status of the smb service.

# systemctl status smb.service
? smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2017-07-07 10:07:54 AEST; 3 days ago
Process: 25847 ExecStart=/usr/sbin/smbd $SMBDOPTIONS (code=exited, status=1/FAILURE)
Main PID: 25847 (code=exited, status=1/FAILURE)
The following entries are logged to the /var/log/messages file:  

Jul 07 10:07:54 localhost smbd[25847]: Unable to open new log file '/var/log/sa...ed
Jul 07 10:07:54 localhost smbd[25847]: [2017/07/07 10:07:54, 0] ../lib/util/de...l)
Jul 07 10:07:54 localhost smbd[25847]: Unable to open new log file '/var/log/sa...ed
Jul 07 10:07:54 localhost smbd[25847]: [2017/07/07 10:07:54, 0] ../source3/smb...n)
Jul 07 10:07:54 localhost smbd[25847]: smbd version 4.2.3 started.
Jul 07 10:07:54 localhost smbd[25847]: Copyright Andrew Tridgell and the Samba ...14
Jul 07 10:07:54 localhost systemd[1]: smb.service: main process exited, code=ex...RE
Jul 07 10:07:54 localhost systemd[1]: Failed to start Samba SMB Daemon.
Jul 07 10:07:54 localhost systemd[1]: Unit smb.service entered failed state.
Jul 07 10:07:54 localhost systemd[1]: smb.service failed.

 

The Solution

 

1. Disable SELinux

In most of the cases in RHEL 7, the samba service does not start if the SELinux is enabled (enforced). Disable SELinux or make it only advisory. The setenforce command is used to change between enforcing and permissive mode. To change to permissive mode:

# setenforce 0

 

Use the getenforce command to view current SELinux mode:

# getenforce
Permissive

 

2. Configure SELinux to allow SAMBA services

In case if you do not want to disable SELinux, you can review the SELinux policy allowing the SAMBA subsystem to run. To check the current SELinux policies, use the below commands.

# getsebool -a | grep samba
# getsebool -a | grep nmb

 

This should give a list of options and whether these are on or off. They should be on. The settings can be changed using the commands given below.

Syntax :

# setsebool -P [boolean] on

 

For example:

# setsebool -P bacula_use_samba on
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I configure a ip range in CentOS7?

You have to use a range file Edit /etc/sysconfig/network-scripts/ifcfg-enp0s3 and make...

Adding a Public IPv6 Address to a Linux Server (CentOS 7)

To configure an additional public IPv6 address in CentOS 7, proceed as follows:...

How To Install EPEL Repository On CentOS And RHEL 7

How to install EPEL for Centos 7 [root@localhost ~]# cat  /etc/centos-release CentOS Linux...

Common Commands (CentOS 7)

Basic Configuration Query or System Locale...

Install LAMP Stack on CentOS 7

Install LAMP Stack on CentOS 7 One of the most simple and barebones solutions you can have for...