Home / Community / Blog

There is "small" difference between

chcon -t some_file_type_t /some/file

and

semanage fcontext -a -t some_file_type_t /some/file
restorecon -v /some/file

The first one only set contex for specified file, but when file id deleted and created again or restored from backup (ie. tar without --selinux attribute) the changed context is not restored.

To permanently change context to file or some files, even created you have to use semanage:

semanage fcontext -a -t fome_file_type_t "/some/dir(/.*)?"

to change context to directory /some/dir and all files in this directory.

Just my blog...

Mon Tue Wed Thu Fri Sat Sun
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31