From the course: CompTIA Linux+ (XK0-005) Cert Prep

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Maintain security context when managing files

Maintain security context when managing files - Linux Tutorial

From the course: CompTIA Linux+ (XK0-005) Cert Prep

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_dir_t. If, however, you want to keep the original security context of the file, you'll 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 list, 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 - X option. Be careful with these commands. Preserving security context…

Contents