Red Hat ENTERPRISE LINUX 5 - DEPLOYMENT Deployment Manual page 781

Hide thumbs Also See for ENTERPRISE LINUX 5 - DEPLOYMENT:
Table of Contents

Advertisement

-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
To make these files viewable from a special user public HTML folder, they need to have a type that
httpd has permissions to read, presuming the Apache HTTP Server is configured for UserDir and the
Boolean value httpd_enable_homedirs is enabled.
chcon -R -t httpd_user_content_t public_html/
ls -Z public_html
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
ls -Z public_html/ -d
drwxrwxr-x
auser
auser
Tip
If the file has no label, such as a file created while SELinux was disabled in the kernel,
you need to give it a full label with chcon system_u:object_r:shlib_t foo.so.
Otherwise, you will receive an error about applying a partial context to an unlabeled file.
Use the restorecon command to restore files to the default values according to the policy. There
are two other methods for performing this operation that work on the entire file system: fixfiles or
a policy relabeling operation. Each of these methods requires superuser privileges. Cautions against
both of these methods appear in
The following example demonstrates restoring the default user home directory context to a set of files
that have different types. The first two sets of files have different types, and are being moved into a
directory for archiving. Their contexts are different from each other, and are incorrect for a standard
user's home directory:
ls -Z /tmp/
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
mv /tmp/{1,2,3} archives/
mv public_html/* archives/
ls -Z archives/
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
-rw-rw-r--
auser
auser
user_u:object_r:user_home_t
user_u:object_r:user_home_t
user_u:object_r:user_home_t
user_u:object_r:user_home_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
Section 45.2.2, "Relabeling a File
user_u:object_r:tmp_t
user_u:object_r:tmp_t
user_u:object_r:tmp_t
user_u:object_r:tmp_t
user_u:object_r:httpd_user_content_t
user_u:object_r:tmp_t
user_u:object_r:httpd_user_content_t
user_u:object_r:tmp_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
user_u:object_r:httpd_user_content_t
Relabeling a File or Directory
3.html
4.html
5.html
index.html
1.html
2.html
3.html
4.html
5.html
index.html
public_html/
System".
/tmp/file1
/tmp/file2
/tmp/file3
file1
file1.html
file2
file2.html
file3
file3.html
file4.html
file5.html
index.html
755

Advertisement

Table of Contents
loading

Table of Contents