From the course: Red Hat Certified System Administrator (EX200) Cert Prep: 2 File Access, Storage, and Security

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Maintain security context when managing files

Maintain security context when managing files

From the course: Red Hat Certified System Administrator (EX200) Cert Prep: 2 File Access, Storage, and Security

Start my 1-month free trial

Maintain security context when managing files

- [Instructor] By default, when you copy a file to a new location, it inherits the security context of the directory it's in according to the security policy. If you copy a file to /home, the type will be user_home_der_T. If however, you want to keep the original security context of the file, you will need to provide additional options to commands. If you copy a file, you may want to provide the -a option. - a is for archive and preserves permissions, access control lists, extended attributes, And SELinux security context. The move command preserves attributes by default because it just moves the files and doesn't change their metadata. When you want to back up your system using tar, you'll want to pass the --selinux option to preserve security context. To copy files from one host to another while Preserving security context, use rsync with the dash capital X option. Be careful with these commands. Preserving security context may not be what you want. The safe option would be to copy…

Contents