Permissions and owners

The chcon command

Changes the SELinux context of a specific file (temporary).

Syntax

sudo chcon -t <tipo> <ruta>

Most useful options

-tContext type

Copy-ready examples

$ sudo chcon -t httpd_sys_content_t /var/www/html/index.htmlLabel a file

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

Typical mistakes

  • The change is lost when restorecon runs; for permanent use semanage.

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