FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 03-19-2009, 12:47 PM
Marcus Moeller
 
Default SELinux - different context on subdirectories

Hi all,

I have created a directory /srv with the following SELinux context:

system_ubject_r:var_t

Now I want to create a subdirectory within /srv which should get a
different context. So I tried to set e.g.:

semanage fcontext -a -t samba_share_t /srv/samba
/sbin/restorecon -v /srv/samba

but the context is always reset to:

system_ubject_r:var_t

What am I missing?

Best Regards
Marcus
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 03-19-2009, 01:35 PM
Ned Slider
 
Default SELinux - different context on subdirectories

Marcus Moeller wrote:
> Hi all,
>
> I have created a directory /srv with the following SELinux context:
>
> system_ubject_r:var_t
>
> Now I want to create a subdirectory within /srv which should get a
> different context. So I tried to set e.g.:
>
> semanage fcontext -a -t samba_share_t /srv/samba
> /sbin/restorecon -v /srv/samba
>
> but the context is always reset to:
>
> system_ubject_r:var_t
>
> What am I missing?
>

Hi Marcus,

Try the following:

semanage fcontext -a -t samba_share_t "/srv/samba(/.*)?"


Ned

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 03-19-2009, 01:41 PM
Ned Slider
 
Default SELinux - different context on subdirectories

Ned Slider wrote:
> Marcus Moeller wrote:
>> Hi all,
>>
>> I have created a directory /srv with the following SELinux context:
>>
>> system_ubject_r:var_t
>>
>> Now I want to create a subdirectory within /srv which should get a
>> different context. So I tried to set e.g.:
>>
>> semanage fcontext -a -t samba_share_t /srv/samba
>> /sbin/restorecon -v /srv/samba
>>
>> but the context is always reset to:
>>
>> system_ubject_r:var_t
>>
>> What am I missing?
>>
>
> Hi Marcus,
>
> Try the following:
>
> semanage fcontext -a -t samba_share_t "/srv/samba(/.*)?"
>
>
> Ned
>


You may also need to manually change the context first:

chcon -v --type=samba_share_t /srv/samba




_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 03-19-2009, 01:44 PM
Marcus Moeller
 
Default SELinux - different context on subdirectories

Dear Ned.

>
> You may also need to manually change the context first:
>
> chcon -v --type=samba_share_t /srv/samba

chcon did the trick.

Thanks a lot
Marcus
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 03-19-2009, 01:48 PM
Ned Slider
 
Default SELinux - different context on subdirectories

Marcus Moeller wrote:
> Dear Ned.
>
>> You may also need to manually change the context first:
>>
>> chcon -v --type=samba_share_t /srv/samba
>
> chcon did the trick.
>
> Thanks a lot
> Marcus

semanage will make the changes persistent through a complete filesystem
relabel (chcon will persist through a reboot, but not a relabel).

Cheers,

Ned


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 05:09 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org