LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-13-2011, 08:24 AM   #1
finnsloss
LQ Newbie
 
Registered: Oct 2011
Location: Dorset - England
Distribution: CentOS
Posts: 2

Rep: Reputation: Disabled
SMB Shares dont work when SMB is run as a service! CentOS 6


Hello,

I have hit a strange problem with SMB on CentOS 6.
The SMB shares will only work if I run "smbd" from the command line (as root).
The SMB shares do not work if i run "service smb start".

When SMB is run on the command line, I can browse the server from Windows XP and access any of the shares defined. If I run SMB as a service, browsing the server just gives a password box, whicch rejects any username/password combination you throw at it.

I have configured Kerberos and successfully run kinit.
I have joined the linux machine to the AD domain.
I have configured smb.conf with the domain and ADS security.

Here is my smb.conf:
Code:
[global]
	workgroup = mydomain
	server string = Network Server

	security = ads
	passdb backend = tdbsam
	realm = MYDOMAIN.LOCAL

	winbind use default domain = yes
	winbind nested groups = yes

	idmap uid = 10000-40000
	idmap gid = 10000-40000

	template shell = /bin/bash

	load printers = yes
	cups options = raw

#============================ Share Definitions ==============================
	
[homes]
	comment = Home Directories
	browseable = no
	writable = yes
	valid users = %S
;	valid users = MYDOMAIN\%S
	
[files]
	path = /files
	writeable = yes
	guest ok = yes
Can anyone shed any light on the situation please?

Thanks,
Finn
 
Old 10-14-2011, 09:33 AM   #2
finnsloss
LQ Newbie
 
Registered: Oct 2011
Location: Dorset - England
Distribution: CentOS
Posts: 2

Original Poster
Rep: Reputation: Disabled
Smile

It looks like the problem is two-fold, time difference between the server and the windows machine, and SELinux!

The time difference meant that all usernames and passwords were rejected. Setting the time more accurately allows the browsing of the server and the available shares.

The shares were still not accessible however, due to SELinux permissions.
Applying the following commands to my /files folder has brought SMB to life!

Code:
# chcon -R -t samba_share_t /files
The -R recursively sets permissions, the -t samba_share_t lets SELinux know you want to share the files.
In order to mark newly created files with the correct type you also need to set the default file context:

Create or edit:
/etc/selinux/targeted/contexts/files/file_contexts.local

Add the line:
Code:
/files(/.*)? system_u:object_r:samba_share_t
Useful commands (run as root):
Code:
sestatus - Check how strict SELinux is (enforcing = block anything without permission, permissive = only produce warnings)
setenforce permissive - Allow all services to run unrestricted, only produce warnings in the log file.
setenforce enforcing - Block all undefined services.
As far as my original problem goes, it now doesn't matter if SMB is run from the command line, or if it starts as a service, SMB Shares are accessible from Windows fine.

I'm still not convinced of the exact problem that ment running "smbd" on the command worked and running "service smb start" didn't work. I guess it will just be one of those mysteries!

Hope this helps others running either CentOS or RHEL (or any distro that has SELinux).

Cheers,
Finn

Last edited by finnsloss; 10-14-2011 at 09:52 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
difference between "service smb restart" and "/etc/rc.d/init.d/smb" powah Linux - Software 1 01-17-2007 05:17 PM
can't get smb/nfs shares to work ShatteredArm Linux - Networking 7 09-12-2005 11:23 PM
SMB shares via Konqueror nrunge Linux - Software 1 01-28-2004 11:45 AM
SMB shares to OS X MadTurki Linux - Networking 6 12-02-2003 06:59 PM
making smb shares viewable from smb client via web browser scottpioso General 3 11-10-2003 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:19 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration