From SELinux Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 18:57, 19 November 2009 (edit)
JoshuaBrindle (Talk | contribs)

← Previous diff
Current revision (18:29, 31 August 2010) (edit) (undo)
Jaxelson (Talk | contribs)

Line 14: Line 14:
# restorecon /src/www # restorecon /src/www

Current revision

Moving files around the filesystem needs no special instructions. However, if a file is moved and restorecon is run on the file in the new location, the file context may change. By adding an equivalence to the policy, restorecon and setfiles programs labeling the files correctly. For example, if you wanted to move the web pages directory from /var/www to /srv/www, you would run the following semanage command.

# semanage fcontext -a -e /var/www /srv/www

This makes the /srv/www directory equivalent to /var/www/; thus, files under this directory will be labeled the same as if the files were in /var/www. To modify the equivalence:

# semanage fcontext -m -e /var/www/ /srv/www

To delete the equivalency:

# semanage fcontext -d /srv/www

Test it out by making a /srv/www directory and running restorecon on it:

# restorecon /src/www
Personal tools