Permissions and owners

The restorecon command

Restores files to their correct SELinux context according to the rules.

Syntax

sudo restorecon [-R] [-v] <ruta>

Most useful options

-RRecursive
-vShows what it changes

Copy-ready examples

$ sudo restorecon -Rv /var/wwwRecalculate contexts

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • It is what you run after copying web files to /var/www.

Related commands

FAQ

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course