Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've a RHEL 5 machine with SELinux disabled.

sestatus -v
SELinux status: disabled

What is the effect of SELinux context on a user's home directory?

ls -lZ -d zxtdfg  
drwx------  zxtdfg dba user_u:object_r:user_home_dir_t:s0 zxtdfg

Is it possible to modify/remove the SELinux context of a single file/directory?

Also I have created a test user with normal useradd command. It doesn't have any SELinux context attributes.

ls -lZ -d test  
drwx------  604 604                         test

Can we add the SELinux context to this user's home directory?

share|improve this question

1 Answer 1

In a machine whith SELinux disabled, the context has no function whatsoever.

It is possible to modify the context of files and directories both temporary and permanently. The tools you need to check are chcon(1) and semanage(8), respectively.

After disabling SELinux, there is no point in labeling files. You would need to re-enable SELinux, force a whole system relabel, and use restorecon(8) on remaining unlabeled files.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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