Change unconfined_u to system_u is failing

Nicsoft asked:

I’ve got a file on my apache/linux server. ls -Z gives:

drwxr-xr-x. apache   apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 localization.smicloud.org

I need to change unconfined_u to system_u like all my other dirs.

I have been googling and on several places I found info that this is how to do it:

semanage fcontext -a -t httpd_sys_content_t localization.smicloud.org

and

semanage fcontext -a -t httpd_sys_rw_content_t localization.smicloud.org

Those give following error:

libsemanage.get_home_dirs: netbeans homedir /var/www/html or its
parent directory conflicts with a file context already specified in
the policy. This usually indicates an incorrectly defined system
account. If it is a system account please make sure its uid is less
than 500 or its login shell is /sbin/nologin.

I’m not really sure why netbeans is mentioned. It is my development tool but it’s not present in the information about the directory. The directory is empty!

How can I fix this?

Update

I wasn’t to clear about my real problem: I am trying to use Netbeans to ftp my files to this folder. It works for all other folders and the only difference I can see between this and those is this part.

My answer:


You don’t need to change this if you’re using the default targeted SELinux policy; it’s ignored.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.