User Tools

Site Tools


classnotes:rh134:selinux:control-selinux

Control Selinux File Context

use semanage to manage contexts

A copy operations inherits destinations context

a move operation retains its selinux context

to troubleshoot selinux issue start by changing to permissive if your action is allowed then selinux is causing issues

then check context of a directory that is correct using

 ls -ldZ  directory location 

compare to directory that has issues

and then apply correct context using

 chcon -R -t context issue_directory 

-R is recursive

THis is not added to the selinux database so if there is a context relabled all these are lost

to add to the database need to use

semanage fcontext -a -t context /website'(/.*)?' 

this adds it now to check it

 semanage fcontext -l | grep website 

then you can restore the new context

 restorecon -FvR /webiste 

-R is recursive -v is verbosity -F force

To display those local customizations use

 semanage fcontext -l -C 
classnotes/rh134/selinux/control-selinux.txt · Last modified: by 127.0.0.1