How do i change the selinux type of a file on redhat?
-
Man page for chcon: https://www.lightnetics.com/post/4086
Man page for semanage: https://www.lightnetics.com/post/4078Note: This is no a persistent change, persistent changes can be made with semanage.
$ ls -Z /tmp/testfile -rw-rw-r--. trainer trainer unconfined_u:object_r:user_tmp_t:s0 /tmp/testfile $ chcon -t bin_t /tmp/testfile $ ls -Z /tmp/testfile -rw-rw-r--. trainer trainer unconfined_u:object_r:bin_t:s0 /tmp/testfile
Remove temporary demo file.
$ rm /tmp/testfile
© Lightnetics 2024