LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 08-13-2010, 03:33 PM   #1
jijawm
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Rep: Reputation: 0
Question 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.

Last edited by jijawm; 08-13-2010 at 03:47 PM.
 
Old 08-13-2010, 04:03 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
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?
 
Old 08-13-2010, 05:25 PM   #3
jijawm
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Original Poster
Rep: Reputation: 0
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.
 
Old 08-14-2010, 06:38 PM   #4
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,152
Blog Entries: 6

Rep: Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835Reputation: 1835
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.
 
Old 08-15-2010, 07:11 PM   #5
jijawm
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Original Poster
Rep: Reputation: 0
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.
 
Old 08-16-2010, 06:02 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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.
 
Old 08-17-2010, 01:15 PM   #7
jijawm
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Original Poster
Rep: Reputation: 0
Question

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.
 
Old 08-17-2010, 05:12 PM   #8
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by jijawm View Post
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?
 
Old 08-18-2010, 11:47 AM   #9
jijawm
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Original Poster
Rep: Reputation: 0
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?
 
  


Reply

Tags
failed, samba, smbconf



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tshark gives "permission denied" writing to (any) file in home dir. kr0m3 Linux - Networking 6 10-08-2019 06:45 AM
Samba + CUPS "Access denied, unable to connect" error lirik Linux - Networking 10 10-13-2011 01:09 PM
[SOLVED] Samba 3.2.5: share "does not exist or permission denied when connecting to [...]" diagnoe Linux - Server 3 10-01-2010 03:51 AM
Permission Denied when trying as "root" to edit xorg.conf d3g@ Linux - Newbie 4 09-07-2006 05:19 PM
sendmail: "permission denied" when using include:/file sohmc Linux - Software 1 05-22-2003 06:40 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration