User Privilege Model
In the Linux security architecture, the superuser account known as root possesses unrestricted access, similar to the Administrator account in Windows environments. This account can execute any system command or modify any file. User identity and privilege levels are distinguished by the User ID (UID). A UID of 0 is reserved exclusively for the root user, granting administrative capabilities. Regular users are assigned UIDs sequentially starting from 1000 in modern distributions. System administrators can inspect user definitions and their corresponding UIDs by examining the /etc/passwd file.
When viewing file details, the ownership structure is critical. The first column typically indicates the user owner, while the second column indicates the group owner. For instance, if a file lists root in both positions, only the root user and members of the root group have specific access rights defined by the permission bits.
File Access Control
Every file and directory in Linux is governed by a permission set comprising four states: read (r), write (w), execute (x), and no permission (-). These permissions are displayed in a ten-character string.
- Character 1: Indicates the file type (e.g.,
-for a regular file,dfor a directory). - Characters 2-4: Define permissions for the file owner (User/u).
- Characters 5-7: Define permissions for the owning group (Group/g).
- Characters 8-10: Define permissions for all other users (Other/o).
These symbolic permissions can also be represented numerically for chmod operations: r equals 4, w equals 2, and x equals 1. For example, a permission set of rwx translates to 7 (4+2+1).
Network Interface Configuration
On Red Hat-based systems, network interface configurations are typically stored in the /etc/sysconfig/network-scripts/ directory. Configuration files usually follow the naming convention ifcfg-<interface_name>, such as ifcfg-ens33 or ifcfg-eth0, corresponding to the physical or virtual network adapters present on the hardware.
Example 1: DHCP Configuration
To configure an interface to obtain an IP address automatically from a DHCP server, the configuration file should resemble the following:
DEVICE=ens33
BOOTPROTO=dhcp
HWADDR=00:1a:2b:3c:4d:5e
ONBOOT=yes
TYPE=Ethernet
Example 2: Static IP Configuration
For servers requiring a fixed address, the BOOTPROTO is set to static, and network parameters are defined manually:
DEVICE=ens33
BOOTPROTO=static
HWADDR=00:1a:2b:3c:4d:5e
ONBOOT=yes
TYPE=Ethernet
IPADDR=10.10.10.50
NETMASK=255.255.255.0
GATEWAY=10.10.10.1
Paramter Explanation:
DEVICE: Specifies the physical network interface name.ONBOOT: Determines if the interface activaets during system boot (yesorno).BOOTPROTO: Defines the protocol used (static,dhcp,none, etc.).
After modifying configuration files, the network service must be restarted to apply changes. On legacy systems, this is done via /etc/init.d/network restart. Additionally, DNS resolution is configured by editing /etc/resolv.conf:
nameserver 1.1.1.1
nameserver 8.8.4.4
RPM Package Management
The Red Hat Package Manager (RPM) is a command-line tool used for installing, querying, verifying, updating, and uninstalling software packages. Below are the essential operations for managing software.
Querying Packages:
# Check if a specific package is installed
rpm -q httpd
# List all installed packages
rpm -qa
# Display detailed information about an installed package
rpm -qi httpd
# List files contained within a package
rpm -ql httpd
# Check dependencies required by a package
rpm -qR httpd
Installing and Upgrading:
Before installation, ensure the repository or directory containing the RPM file is accessible. The full package filename must be provided for local installations.
# Install a package with verbose output and progress hash
rpm -ivh software-package-1.0.x86_64.rpm
# Upgrade an existing package
rpm -Uvh software-package-2.0.x86_64.rpm
# Force installation without checking dependencies (use with caution)
rpm -ivh --nodeps software-package-1.0.x86_64.rpm
Removing Packages:
# Erase a package from the system
rpm -e httpd
When using the install (-i), upgrade (-U), or erase (-e) options, the command typically requires the package name for removal but the full filename for local enstallation.