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,600 courses taught by industry experts or purchase this course individually.

Restore SELinux default file contexts

Restore SELinux default file contexts

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

Start my 1-month free trial

Restore SELinux default file contexts

- (Narrator)In standard Unix permissions the file permissions are stored with the file. With SELinux, the security context is also stored with the file, in the extended attributes area. However, there are default security context settings stored in the SELinux security policy itself. These default settings, may see that all files in slash home have a certain type. Let's take a look. Type ls -lz /home and hit enter Notice that the security context of slash home is, user_home_dir_t. We can change the security context of any file, using the chcon command. Let's make a file called, newfile.txt in our home directory, by typing, touch newfile.txt, and hit enter. Let's verify the context using ls. Typing, ls -lz and hit enter. We can see that its type is, user_home_t. Now let's change the type to something else. Note, that we don't need to elevate privileges, when we're doing this to our own files. If you want to change the context of files, belonging to another user, you'll need to elevate…

Contents