I wonder if it's possible to force set a given string (e.g. u:object_r:blah_blah_blah:s0) as the SELinux context of a file.
Basically I'm going to root an Android x86 installation by placing files manually on a soft boot Ubuntu. However chcon doesn't allow me to set stuffs like u:object_r:system_file:s0 because such a context is non-existent on Ubuntu. Actually I can use the --reference-file=X option but it would be better if I can manually type the string.

sudo setfattr -n security.selinux -v u:object_r:system_file:s0 'path/fileName'

you may need to install attr first and see official docs

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.