# Introduction to Linux Security
Linux powers the majority of cloud servers, containers, supercomputers, and security appliances worldwide. Securing Linux requires a disciplined approach across file permissions, service privileges, authentication, and network exposures.
# File Permissions & Ownership
Linux uses a standard discretionary access control model: Read (4), Write (2), Execute (1) applied to Owner, Group, and Others.
# Set read/write for root only on shadow password file
chmod 600 /etc/shadow
chown root:root /etc/shadow
# Ensure authorized_keys has restricted permissions
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh# SSH Hardening
Disable root login, enforce key-based authentication, and disable legacy password authentication in /etc/ssh/sshd_config.
Ensure 'PermitRootLogin no' and 'PasswordAuthentication no' are configured in production environments.
# UFW & Firewall Configuration
Block all unsolicited inbound traffic by default and permit only necessary ports.
# Auditing & Log Monitoring
Inspect auth.log, journalctl, and auditd logs regularly to detect brute-force attempts and privilege escalation anomalies.