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 15326 times.
Share your Linux code snippets:
- Get some recognition & a link back to your site.
- Create your own code library.
- Help your fellow developers, as they have helped you.
Related Articles