Book Image

Red Hat Enterprise Linux 9 Administration - Second Edition

By : Pablo Iranzo Gómez, Pedro Ibáñez Requena, Miguel Pérez Colino, Scott McCarty
2 (2)
Book Image

Red Hat Enterprise Linux 9 Administration - Second Edition

2 (2)
By: Pablo Iranzo Gómez, Pedro Ibáñez Requena, Miguel Pérez Colino, Scott McCarty

Overview of this book

With Red Hat Enterprise Linux 9 becoming the standard for enterprise Linux used from data centers to the cloud, Linux administration skills are in high demand. With this book, you’ll learn how to deploy, access, tweak, and improve enterprise services on any system on any cloud running Red Hat Enterprise Linux 9. Throughout the book, you’ll get to grips with essential tasks such as configuring and maintaining systems, including software installation, updates, and core services. You’ll also understand how to configure the local storage using partitions and logical volumes, as well as assign and deduplicate storage. You’ll learn how to deploy systems while also making them secure and reliable. This book provides a base for users who plan to become full-time Linux system administrators by presenting key command-line concepts and enterprise-level tools, along with essential tools for handling files, directories, command-line environments, and documentation for creating simple shell scripts or running commands. With the help of command line examples and practical tips, you’ll learn by doing and save yourself a lot of time. By the end of the book, you’ll have gained the confidence to manage the filesystem, users, storage, network connectivity, security, and software in RHEL 9 systems on any footprint.
Table of Contents (26 chapters)
1
Part 1 – Systems Administration – Software, User, Network, and Services Management
9
Part 2 – Security with SSH, SELinux, a Firewall, and System Permissions
14
Part 3 – Resource Administration – Storage, Boot Process, Tuning, and Containers
21
Part 4 – Practical Exercises

Restoring changed file contexts to the default policy

In the previous section, we mentioned how semanage enables us to perform changes to the policy, which is the recommended way to perform changes and to persist them for future files and folders, but that is not the only way we can perform operations.

From the command line, we can use the chcon utility to change the context for a file. This will allow us to define the user, the role, and the type for the file we want to alter, and similar to other filesystem utilities such as chmod or chown, we can also affect files recursively, so it’s easy to set a full folder hierarchy to the desired context.

One feature that I always found very interesting is the ability to copy the context of a file via the --reference flag so that the same context as the referenced file is applied to the target one.

When we were introducing the example of httpd earlier in this chapter, we did a test with two files, index1.htm and index2.htm,...