[FC5] Samba and SELinux

Paul Howarth paul at city-fan.org
Thu Apr 6 06:48:58 UTC 2006


On Wed, 2006-04-05 at 13:26 -0700, Dan Thurman wrote:
> On Wed, 2006-04-05 at 12:59 -0700, Bob Kashani wrote:
> > On Wed, 2006-04-05 at 10:59 -0700, Dan Thurman wrote:
> > > Folks,
> > > 
> > > What is the procedure for creating Samba shares and
> > > getting around the SELinux issues?
> > > 
> > > Samba by default no longer works with shares such
> > > as [homes] and any other added shares without administrator
> > > intervention to add SELinux labels on share directories.
> > > 
> > > Please direct me to the FAQ for Samba & SELinux or
> > > please tell me what I have to do to get samba shares
> > > working.
> > > 
> > > In my case - I am getting permission denied in the audit
> > > logs and in the message logs for nmbd, I am getting
> > > directories do not exists errors (when they actually
> > > do!).
> > 
> > /usr/sbin/setsebool -P samba_enable_home_dirs=1
> > /usr/sbin/setsebool -P smbd_disable_trans=1
> > 
> > That's what I had to do to get samba working with home shares on FC5.
> > 
> > Bob
> > 
> 
> Thanks for the response!  Yes, I did that for [home] but
> the problem is what to do with: /var/www
> 
> There are many different contexts for this directory and all
> the files under it and I was not sure how to make this directory
> a samba share without blowing away the original context in fear
> of breaking it all to bits.
> 
> I want to keep all the original context AND add samba share context
> OR the public_share_rw_t as Stephen Smalley recommended but I was
> not sure how to do that.  This is the question I asked of Mr Smalley
> and I am waiting to hear of his response.

You can't have multiple contexts for a file, so it's not possible AFAIK
to have both the original context *and* public_content_rw_t.

If your web server is only serving static data (nothing that requires
write access to /var/www for the web server itself), you could
relabel /var/www/* as public_content_t. If you have internal scripting
like PHP that needs write access, you could use public_content_rw_t.

However, if you're using cgi scripts that currently need
httpd_script_exec_t, you'd need to generate a local policy module that
allowed samba to read/write the httpd_* types.

Paul.




More information about the selinux mailing list