LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (http://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Unable to open configuration file "/etc/samba/smb.conf" Permission denied (http://www.linuxquestions.org/questions/linux-enterprise-47/unable-to-open-configuration-file-etc-samba-smb-conf-permission-denied-826073/)

jijawm 08-13-2010 03:33 PM

Unable to open configuration file "/etc/samba/smb.conf" Permission denied
 
Hello, all you Linux experts!
I did a
yum install samba
and
yum install samba-swat
on RHEL5 Tikanga (2.6.18-194.8.1.el5PAE)
During the day while I was configuring smb.conf the samba service would start just fine via:
service smb start
Now it says FAILED for smbd and nmbd every time I try to start it.
The log files smbd.log and nmbd.log under /var/log/samba show the message:
param/params.c:OpenConfFile(536)
params.c:OpenConfFile() - Unable to open configuration file "/etc/samba/smb.conf" Permission denied
I checked all the permissions on all the directories in the path /etc/samba/smb.conf
and compared them all to a system I know works.
I uninstalled samba and re-installed samba - no dice, still get FAILED and message in log file.
I tried googling for an answer and nothing in the search results was any help.

Please advise,
John Ford
p.s. testparm does not deliver any errors.

teckk 08-13-2010 04:03 PM

Quote:

Now it says FAILED for smbd and nmbd every time I try to start it.
You are trying to open those demons as root?

jijawm 08-13-2010 05:25 PM

Actually, I am logged is as a regular user sith sudo privileges.
I first
sudo ksh
And at the resulting # prompt I then
su -
which supposedly gives me everything as if I logged in as root, including the path name, home directory, etc.
From there I am able to install packages and stop/start services, including iptables.

teckk 08-14-2010 06:38 PM

sudo allows a user to run commands as root with the users own password.

What user can do as root is specified in the sudoers file.

Quote:

I first
sudo ksh
And at the resulting # prompt I then
su -
You are opening ksh as root and then switching to root again?
# prompt means root. I'm not sure what you are doing but it looks like you figured out how to run commands as root. It's a bad idea to log into your box as root. It is a security risk. You can google why.

sudo allows a user to run a command as root and you'll have a log entry for it and what user did.

You should be able to open a shell and enter
Code:

sudo yum install firefox
and install your software.

Code:

sudo start netd
will allow you to start a demon with root permissions.

jijawm 08-15-2010 07:11 PM

The reason I do the su - is because I am installing non-yum, non-rpm applications that have many embedded commands in the installation scripts that require root access. Unpredictable, difficult to fix things occur when they try to do something that requires root access.

catkin 08-16-2010 06:02 AM

Have you tried opening /etc/samba/smb.conf directly, that is not via service smb start but for example by cat /etc/samba/smb.conf? If that works then the problem focus changes to why service smb start is not opening /etc/samba/smb.conf with root privileges -- either it's not the file you think it is (chroot?) or samba has switched user.

jijawm 08-17-2010 01:15 PM

Not only have I opened it, I have modified it and saved it with the settings I want. e.g., setting up shared directory. I have since put the file back to its original state after it stopped working.

I have compared the permissions to a system that works and there is nothing unusual in the permissions, the owner, and the group:
# cd /etc/
# l -d samba
drwxr-xr-x 2 root root 4096 Aug 10 09:34 samba
# l samba
total 84
-rw-r--r-- 1 root root 20 Jun 10 08:37 lmhosts
-rw------- 1 root root 4096 Aug 9 16:42 passdb.tdb
-rw------- 1 root root 8192 Aug 9 13:13 secrets.tdb
-rw-r--r-- 1 root root 9733 Jun 10 08:37 smb.conf
-rw-r--r-- 1 root root 591 Aug 9 15:53 smb.conf.bu
-rw-r--r-- 1 root root 9733 Jun 10 08:37 smb.conf.orig
-rw-r--r-- 1 root root 97 Jun 10 08:37 smbusers
-rw-r--r-- 1 root root 97 Jun 10 08:37 smbusers.orig
From $ prompt:
[johnmf@extractor ~]$ sudo service smb start <- Attempt via sudo command w/o root shell.
[sudo] password for johnmf:
sudo: service: command not found <- Doesn't find service program file.
[johnmf@extractor ~]$ sudo bash
[root@extractor ~]# sudo service smb start
sudo: service: command not found <- Still doesn't find service program file.
[root@extractor ~]# su - <- Okay, then let's run as root (or should I focus on fixing $PATH?
[root@extractor ~]# sudo service smb start
Starting SMB services: [FAILED]
Starting NMB services: [FAILED]
[root@extractor ~]# service smb start
Starting SMB services: [FAILED]
Starting NMB services: [FAILED]
Okay, let's try another way...
[root@extractor ~]# /etc/init.d/smb start
Starting SMB services: [FAILED]
Starting NMB services: [FAILED]
Okay, then let's manually excecute the commands as specified in /etc/init.d/smb
[root@extractor ~]# . /etc/init.d/functions
[root@extractor ~]# . /etc/sysconfig/samba
[root@extractor ~]# echo $SMBDOPTIONS
-D
[root@extractor ~]# daemon smbd $SMBDOPTIONS
[root@extractor ~]# [ OK ]
[root@extractor ~]# daemon nmbd $NMBDOPTIONS
[root@extractor ~]# [ OK ]

As you can see, the daemon will start when executed from a command line, but I cannot restart the daemon using service or /etc/init.d/smb. It will stop the services and then fail to start. Also, even though smbd and nmbd are running as processes, access to them via swat fails. It will connect, but fail on trying to write /etc/samba/smb.conf.

custangro 08-17-2010 05:12 PM

Quote:

Originally Posted by jijawm (Post 4069276)
Not only have I opened it, I have modified it and saved it with the settings I want. e.g., setting up shared directory. I have since put the file back to its original state after it stopped working.

I have compared the permissions to a system that works and there is nothing unusual in the permissions, the owner, and the group:
# cd /etc/
# l -d samba
drwxr-xr-x 2 root root 4096 Aug 10 09:34 samba
# l samba
total 84
-rw-r--r-- 1 root root 20 Jun 10 08:37 lmhosts
-rw------- 1 root root 4096 Aug 9 16:42 passdb.tdb
-rw------- 1 root root 8192 Aug 9 13:13 secrets.tdb
-rw-r--r-- 1 root root 9733 Jun 10 08:37 smb.conf
-rw-r--r-- 1 root root 591 Aug 9 15:53 smb.conf.bu
-rw-r--r-- 1 root root 9733 Jun 10 08:37 smb.conf.orig
-rw-r--r-- 1 root root 97 Jun 10 08:37 smbusers
-rw-r--r-- 1 root root 97 Jun 10 08:37 smbusers.orig
From $ prompt:
[johnmf@extractor ~]$ sudo service smb start <- Attempt via sudo command w/o root shell.
[sudo] password for johnmf:
sudo: service: command not found <- Doesn't find service program file.
[johnmf@extractor ~]$ sudo bash
[root@extractor ~]# sudo service smb start
sudo: service: command not found <- Still doesn't find service program file.
[root@extractor ~]# su - <- Okay, then let's run as root (or should I focus on fixing $PATH?
[root@extractor ~]# sudo service smb start
Starting SMB services: [FAILED]
Starting NMB services: [FAILED]
[root@extractor ~]# service smb start
Starting SMB services: [FAILED]
Starting NMB services: [FAILED]
Okay, let's try another way...
[root@extractor ~]# /etc/init.d/smb start
Starting SMB services: [FAILED]
Starting NMB services: [FAILED]
Okay, then let's manually excecute the commands as specified in /etc/init.d/smb
[root@extractor ~]# . /etc/init.d/functions
[root@extractor ~]# . /etc/sysconfig/samba
[root@extractor ~]# echo $SMBDOPTIONS
-D
[root@extractor ~]# daemon smbd $SMBDOPTIONS
[root@extractor ~]# [ OK ]
[root@extractor ~]# daemon nmbd $NMBDOPTIONS
[root@extractor ~]# [ OK ]

As you can see, the daemon will start when executed from a command line, but I cannot restart the daemon using service or /etc/init.d/smb. It will stop the services and then fail to start. Also, even though smbd and nmbd are running as processes, access to them via swat fails. It will connect, but fail on trying to write /etc/samba/smb.conf.

Not sure if this is relevant...but is SELinux turned on?

jijawm 08-18-2010 11:47 AM

Holy mackerel!
I edited the file
/etc/selinux/config
and set
SELINUX=disabled
and rebooted the system.

Then
# service smb start
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]

So SELinux is preventing smb from starting.
It has been messing around with other things I've tried to do, too.

Any recommendations?


All times are GMT -5. The time now is 02:07 AM.