Keeping your server up to date is essential for security. Ubuntu's unattended-upgrades package handles this automatically. Install unattended-upgrades sudo apt install unattended-upgrades Enable Automatic Updates sudo dpkg-reconfigure --priority=low unattended-upgrades Configure Update Behavior Edit /etc/apt/apt.conf.d/50unattended-upgrades to control which packages are updated and whether the server auto-reboots: Unattended-Upgrade::Automatic-Reboot "true"; Unattended-Upgrade::Automatic-Reboot-Time "02:00"…
Linux Guides
Linux administration, hardening, and troubleshooting.
A default SSH configuration is a common attack target. These steps reduce your attack surface significantly by changing defaults and restricting access. Change the Default Port Edit /etc/ssh/sshd_config and change: Port 2222 Disable Root Login PermitRootLogin no Limit Login Attempts MaxAuthTries 3 Restrict to Specific Users AllowUsers alice bob Use Fail2Ban to Block Brute Force sudo apt install fail2ban sudo systemctl enable fail2ban Restart SSH after changes: sudo systemctl restart sshd
Samba lets Linux systems share files and printers with Windows machines using the SMB protocol. This guide sets up a basic shared folder accessible from Windows. Install Samba sudo apt install samba Create a Shared Directory sudo mkdir /srv/samba/shared sudo chmod 777 /srv/samba/shared Configure Samba Add to /etc/samba/smb.conf : [shared] path = /srv/samba/shared browseable = yes writable = yes guest ok = yes Restart Samba sudo systemctl restart smbd
htop is an interactive process viewer for Linux that provides a real-time overview of CPU, RAM, and swap usage with a user-friendly interface. Install htop sudo apt install htop # Debian/Ubuntu sudo dnf install htop # Fedora/RHEL Launch htop htop Key Shortcuts Inside htop F6 — Sort by column F9 — Kill a process F5 — Tree view F4 — Filter by name Filter Processes by User htop -u www-data
Cron is the standard Linux job scheduler. It runs commands or scripts at specified times and intervals. Open the Crontab Editor crontab -e Cron Syntax # m h dom mon dow command 0 2 * * * /usr/bin/backup.sh This runs the script every day at 2:00 AM. Common Examples # Every 5 minutes */5 * * * * /usr/bin/check.sh # Every Monday at midnight 0 0 * * 1 /usr/bin/weekly.sh View Scheduled Jobs crontab -l
Managing storage devices is a core Linux administration skill. This guide covers identifying, formatting, and mounting drives on any Linux distribution. List Available Drives lsblk sudo fdisk -l Format a Partition sudo mkfs.ext4 /dev/sdb1 Mount the Drive sudo mkdir /mnt/data sudo mount /dev/sdb1 /mnt/data Persist Mount on Boot Add to /etc/fstab : /dev/sdb1 /mnt/data ext4 defaults 0 2
UFW (Uncomplicated Firewall) is the default firewall tool for Ubuntu. It simplifies iptables configuration with an easy command-line interface. Install and Enable UFW sudo apt install ufw sudo ufw enable Allow Common Services sudo ufw allow ssh sudo ufw allow http sudo ufw allow https Check Status sudo ufw status verbose Block a Specific IP sudo ufw deny from 192.168.1.100
Password-based SSH login is vulnerable to brute-force attacks. SSH key authentication is faster and significantly more secure. Generate a Key Pair ssh-keygen -t ed25519 -C "[email protected]" Copy the Public Key to the Server ssh-copy-id user@server-ip Disable Password Login Edit /etc/ssh/sshd_config and set: PasswordAuthentication no PubkeyAuthentication yes Then restart SSH: sudo systemctl restart sshd
LAMP (Linux, Apache, MySQL, PHP) is a classic web server stack. This guide installs and configures all four components on Ubuntu 22.04 LTS. Install Apache sudo apt update sudo apt install apache2 Install MySQL sudo apt install mysql-server sudo mysql_secure_installation Install PHP sudo apt install php libapache2-mod-php php-mysql Test the Setup Create a test file at /var/www/html/info.php with <?php phpinfo(); ?> and open it in your browser.
Nginx is a high-performance, open-source web server and reverse proxy essential for modern web applications . Its efficiency and versatility make it a popular choice for handling HTTP requests, load balancing , and serving static content. This guide will teach you how to install and use Nginx on Ubuntu 24.04. server { listen 80; server_name yourdomain.com www.yourdomain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name yourdomain.com www.yourdomain.com; ssl_certificate…