0

I have a couple of files that I copied from one device to another and it's causing problems because the file permissions need to be changed.

What I'm getting:

$ ls -laZ
...
drwxrwx--x   2 u0_a119 u0_a119       u:object_r:app_data_file:s0:c119,c256,c512,c768  4096 2019-07-21 08:25 databases

What I need:

drwxrwx--x   2 u0_a215 u0_a215       u:object_r:app_data_file:s0:c215,c256,c512,c768   4096 2019-07-21 08:25 databases

The basic file permissions are fine and changing ownership with chown u0_a215:u0_a215 databases would be easy. But how do I change the u:object_r:app_data_file:s0:c215,c256,c512,c768 thing?

1 Answer 1

1

You seem to be using a Multi-Category Security (MCS) SELinux policy. If so, then those categories might have human-readable descriptions defined in /etc/selinux/targeted/setrans.conf. The list of category descriptions could also be viewed with chcat -L.

I don't know how the categories are defined at your site, and it's probably best it stays that way. But changing the c119 to c215 might mean something like changing something that is marked as "payroll information" to "medical information". So it is an operation that requires privileges appropriate for accessing both categories.

The command to change the categories would be:

chcat -- +c215 -c119 databases
1
  • Thank you, that's very valuable information. chcat or /etc/selinux/targeted/setrans.conf don't exist on that device unfortunately. I do have /etc/selinux though and at least setenforce , secilc and restorecon (which seems like black magic) do exist. The device I'm working with is an Android device btw in case that's relevant.
    – Forivin
    Jul 16 at 22:09

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.