Blog | Technical

Easy way to remove SELinux permissions?

Many files have permissions which include a dot at the end,
>> e.g.:
>>
>> -rw-rw-r--.

https://lists.fedoraproject.org/pipermail/users/2009-September/087990.html
https://ubuntuforums.org/showthread.php?t=2229448

> Q: How can I EASILY remove all SELinux attributes, e.g. perhaps with a
>> single command?
>
> If SELinux is disabled, then you should be able to do this:
> find / -exec setfattr -x security.selinux {} \.
>
> You might want to further qualify the find statement to avoid noise on
> filesystems that don`t support security contexts, e.g.
>
> find / \( -fstype ext2 -o -fstype ext3 -o -fstype ext4 -o -fstype btrfs \) -exec setfattr -x security.selinux {} \.
>