Unable to open configuration file "/etc/samba/smb.conf" Permission denied
Linux - EnterpriseThis forum is for all items relating to using Linux in the Enterprise.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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.
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 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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.