Linux System Administration Fundamentals: Complete Server Management Guide

Master essential Linux system administration skills including user management, security hardening, and system monitoring. Learn practical techniques for managing production Linux servers efficiently.

Introduction to Linux System Administration

System administration forms the backbone of any Linux infrastructure. This guide covers fundamental skills every Linux administrator needs to manage servers effectively and securely.

1. User and Group Management

Advanced User Administration

# Create user with specific home directory and shell
sudo useradd -m -d /home/webapp -s /bin/bash -c "Web Application User" webapp

# Set password and force change on first login
sudo passwd webapp
sudo chage -d 0 webapp

# Add user to multiple groups
sudo usermod -a -G sudo,docker,www-data webapp

# Set user account expiration
sudo chage -E 2024-12-31 webapp

# Lock/unlock user account
sudo usermod -L webapp  # Lock
sudo usermod -U webapp  # Unlock

2. System Monitoring and Performance

# Monitor system resources
htop
iotop -o
nethogs

# Check system information
lscpu
free -h
df -h
lsblk

# Monitor processes
ps aux --sort=-%cpu | head -10
ps aux --sort=-%mem | head -10

3. Security Hardening

# Configure SSH security
sudo nano /etc/ssh/sshd_config
# Disable root login: PermitRootLogin no
# Change default port: Port 2222
# Use key authentication: PasswordAuthentication no

# Configure firewall
sudo ufw enable
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

4. Log Management

# View system logs
journalctl -f
journalctl -u ssh.service
journalctl --since yesterday
journalctl --priority=err

# Configure log rotation
sudo nano /etc/logrotate.d/webapp
# /var/log/webapp/*.log {
#     daily
#     rotate 30
#     compress
#     delaycompress
#     missingok
#     create 644 webapp webapp
# }

Conclusion

Effective system administration requires continuous monitoring, proper security practices, and proactive maintenance. These fundamentals provide a solid foundation for managing Linux servers.

Add Comment