[RHEL 5] Why I'm getting the error "smbd Unable to open new log file /var/log/samba/machine.log: Permission denied" ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5.x
  • Samba 3.0.33-3.28

Issue

Why I'm getting this error when some smbd process tries to open or write in the log file?

smbd Unable to open new log file /var/log/samba/machine.log: Permission denied

Resolution

The cause is the execution of the smbcontrol or smbd command when smbd runs as user uid (not root uid). When smbd runs as user uid, the log file cannot be opened again because there are no right to write to the directory.

To solve the problem, extend the permissions of /var/log/samba/:

#chgrp "DOMAIN+domain users" /var/log/samba
#chmod 770 /var/log/samba

Root Cause

samba processes (smbcontrol, smbd) runing with a different user that is not root.

Diagnostic Steps

Verify if there is any smbd process running with a non-root user:

# ps aux | grep smbd
root     22000  0.0  1.9 185660 20448 ?        S    Sep30   2:38 smbd -D
12980    22802  1.3  0.5 172552  5420 ?        S    11:42   0:00 smbd -D
root     24635  0.0  0.6 172352  6280 ?        S    09:31   0:06 smbd -D
root     24728  0.1  0.6 175148  6964 ?        S    10:23   0:05 smbd -D
15400    25347  0.0  0.5 172144  5664 ?        S    11:15   0:00 smbd -D
root     27677  0.0  1.3 211856 14100 ?        S    Oct01   2:38 smbd -D
14414    27731  0.1  0.7 173084  7208 ?        S    Oct01   5:44 smbd -D

If yes, you will notice the Permission Denied message in log files.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments