2

On my system I don't have selinux set up, but I have a removeable disk containing an EXT4 filesystem from a machine that does use selinux. I need to change a file's context on that filesystem. chcon fails with "Operation not supported". Is there a way to achieve this?

1

You could run a Linux distribution with SELinux enabled, such as Fedora, in a virtual machine. Installing Fedora in a VM takes only a few minutes, not including the download time. Use VM software that supports USB passthrough (such as VirtualBox with the non-open-source extensions) and access the disk directly from the VM.

1

You could try to use setfattr to set the security.selinux attribute on the file directly, something like:

setfattr -n security.selinux -v "unconfined_u:object_r:foo_t:s0" /tmp/bar

To see the label, you can use getfattr -n security.selinux /tmp/bar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.