setfattr -h -x security.selinux
find . -print0 |xargs -0 -n 1 setfattr -h -x security.selinux
#for apache
chcon --reference=/etc/httpd/modules/mod_auth_basic.so [the file(s)]
chcon -u system_u [the files(s)]
chcon -R -h -t httpd_sys_content_t [the file(s)]
Linux Remove SELinux security context from files
The setfattr command does not supply a recursive option, so the second command below uses find to achieve recursion.
Snippet Viewed 16623 times.
Share your Linux code snippets:
- Get some recognition & link back to your site.
Related Articles