-
As the Linux root user, run the touch /var/www/html/file{1,2,3}
command to create three files (file1
, file2
, and file3
). These files inherit the httpd_sys_content_t
type from the /var/www/html/
directory:
# touch /var/www/html/file{1,2,3}
# ls -Z /var/www/html/
-rw-r--r-- root root unconfined_u:object_r:httpd_sys_content_t:s0 file1
-rw-r--r-- root root unconfined_u:object_r:httpd_sys_content_t:s0 file2
-rw-r--r-- root root unconfined_u:object_r:httpd_sys_content_t:s0 file3
-
Run the cd /var/www/html/
command to change into the /var/www/html/
directory. Once in this directory, as the Linux root user, run the star -xattr -H=exustar -c -f=test.star file{1,2,3}
command to create a Star archive named test.star
:
# star -xattr -H=exustar -c -f=test.star file{1,2,3}
star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
-
As the Linux root user, run the mkdir /test
command to create a new directory, and then, run the chmod 777 /test/
command to allow all users full-access to the /test/
directory.
-
Run the cp /var/www/html/test.star /test/
command to copy the test.star
file in to the /test/
directory.
-
Run the cd /test/
command to change into the /test/
directory. Once in this directory, run the star -x -f=test.star
command to extract the Star archive:
$ star -x -f=test.star
star: 1 blocks + 0 bytes (total of 10240 bytes = 10.00k).
-
Run the ls -lZ /test/
command to view the SELinux contexts. The httpd_sys_content_t
type has been retained, rather than being changed to default_t
, which would have happened had the --selinux
not been used:
$ ls -lZ /test/
-rw-r--r-- user1 group1 unconfined_u:object_r:httpd_sys_content_t:s0 file1
-rw-r--r-- user1 group1 unconfined_u:object_r:httpd_sys_content_t:s0 file2
-rw-r--r-- user1 group1 unconfined_u:object_r:httpd_sys_content_t:s0 file3
-rw-r--r-- user1 group1 unconfined_u:object_r:default_t:s0 test.star
-
If the /test/
directory is no longer required, as the Linux root user, run the rm -ri /test/
command to remove it, as well as all files in it.
-
If star
is no longer required, as the Linux root user, run the yum remove star
command to remove the package.