// Defense is the best offense.
YOUR SERVER IS UNDER CONSTANT ATTACK.
Every minute, automated bots scan the internet for vulnerable servers. They hunt for weak passwords, open ports, and misconfigured services. Without proper hardening, your server is a sitting duck.
HARDENING IS YOUR SHIELD.
Server hardening is the process of securing a system by reducing its attack surface. Close unnecessary ports, disable unused services, enforce strong authentication, and monitor for intrusions. Make your server a fortress.
BECOME A SECURITY GUARDIAN.
Learn SSH key authentication, firewall rules, user privileges, automatic updates, intrusion detection, log monitoring, and security scanning. Protect your data and your users from threats.
12 lessons. Complete server protection.
What server hardening is, why it matters, and understanding attack surfaces.
BeginnerDisable root login, enable key authentication, change default port, and configure fail2ban.
BeginnerInstall UFW, configure rules, set default deny policy, and allow necessary services.
BeginnerCreate users, configure sudo privileges, disable root, and enforce password policies.
BeginnerConfigure unattended-upgrades for automatic security updates and patches.
IntermediateInstall fail2ban, configure jails, and set up automatic IP banning for brute force attacks.
IntermediateMaster chmod, chown, umask, and understand special permissions and access control.
IntermediateAudit running services with ss, disable unnecessary services, and practice minimal installation.
IntermediateMonitor system logs with journalctl, configure logwatch, and manage rsyslog.
IntermediateRun security audits with Lynis, detect rootkits with rkhunter and chkrootkit.
AdvancedImplement backup solutions with rsync, schedule with cron, and manage offsite backups.
AdvancedComplete server hardening checklist and ongoing security maintenance practices.
AdvancedServer hardening is not optional—it's essential. Every day, thousands of servers are compromised due to basic security misconfigurations. A single open port, weak password, or outdated package can be the entry point for attackers.
The attack surface of a server is the sum of all possible entry points. Every installed package, running service, and open port expands this surface. Hardening systematically reduces this surface by removing unnecessary components and securing essential ones.
Security is a process, not a product. Threats evolve, new vulnerabilities are discovered, and attackers develop new techniques. Regular audits, updates, and monitoring are required to maintain security over time.
Secure your server before attackers secure it for you.
Server hardening is the process of securing a server by reducing its vulnerability surface. It involves removing unnecessary software, closing unused ports, configuring security policies, and implementing monitoring systems.
The attack surface is the sum of all possible entry points an attacker could exploit:
1. Server hardening reduces the _____ surface.
Hint: Vulnerability
2. Defense in _____ means multiple security layers.
Hint: Opposite of shallow
3. SSH uses port _____ by default.
Hint: Twenty-two
4. Always test changes in a _____ environment first.
Hint: Test environment
SSH (Secure Shell) is the primary way to remotely administer Linux servers. It's also the #1 attack vector for brute force attacks. Proper SSH hardening is critical for server security.
1. Set PermitRootLogin to _____ to disable root SSH.
Hint: Opposite of yes
2. ssh-keygen creates a key _____.
Hint: Two keys
3. Use ssh-copy-id to copy your _____ key.
Hint: Not private
4. Test in a separate _____ before closing current session.
Hint: Command window
UFW (Uncomplicated Firewall) is a user-friendly frontend for iptables. It provides a simple command-line interface for managing firewall rules on Ubuntu and Debian systems.
Set default to deny incoming and allow outgoing:
1. UFW stands for Uncomplicated _____.
Hint: Network security
2. Default policy should be deny _____.
Hint: Entering
3. HTTP uses port _____.
Hint: Eighty
4. HTTPS uses port _____.
Hint: Four-forty-three
Never use root for daily operations. Create a regular user with sudo privileges:
1. Add users to the _____ group for sudo access.
Hint: Super user do
2. Use _____ to safely edit sudoers file.
Hint: vi + sudo
3. Lock root with passwd -_____.
Hint: Letter L
4. Minimum password length should be at least _____ characters.
Hint: Twelve
Unpatched vulnerabilities are a leading cause of server compromises. Automatic security updates ensure critical patches are applied without delay, closing windows of opportunity for attackers.
1. _____-upgrades handles automatic updates.
Hint: Not watched
2. Enable _____ reboot for critical kernel updates.
Hint: Auto
3. apt _____ downloads package lists.
Hint: Refresh
4. apt _____ installs new versions.
Hint: Level up
Fail2ban is an intrusion prevention framework that monitors log files for malicious activity and automatically bans IP addresses that show suspicious behavior—such as multiple failed login attempts.
1. Fail2ban monitors _____ files for attacks.
Hint: System records
2. Bantime is measured in _____.
Hint: 3600 = 1 hour
3. Maxretry sets the number of _____ attempts allowed.
Hint: Unsuccessful
4. Use fail2ban-_____ to manage bans.
Hint: Command interface
Linux file permissions control who can read, write, or execute files. Understanding and properly setting permissions is essential for system security.
1. chmod _____ gives owner read and write.
Hint: rw-------
2. _____ changes file owner.
Hint: Change owner
3. _____ sets default permissions for new files.
Hint: User mask
4. Sticky bit is set with chmod _____.
Hint: Plus T
Every running service is a potential attack vector. Regularly audit what services are running and disable those you don't need.
1. Use _____ command to list listening ports.
Hint: Socket statistics
2. _____ a service to prevent it from starting.
Hint: Hide/disable
3. apt _____ removes unused packages.
Hint: Clean up
4. _____ is a tool for port scanning.
Hint: Network mapper
Logs are your window into server activity. They record who accessed your system, what they did, when they did it, and whether they succeeded or failed. Without log monitoring, you're flying blind.
1. journalctl -f follows logs like _____.
Hint: End of file
2. auth.log tracks _____ attempts.
Hint: Login
3. logwatch sends daily _____ reports.
Hint: Electronic mail
4. _____ rotates logs to prevent disk fill.
Hint: Turn around
Regular security scans help identify vulnerabilities before attackers do. They provide an objective assessment of your server's security posture and track improvements over time.
1. _____ audits system security configuration.
Hint: Security scanner
2. rkhunter detects _____.
Hint: Hidden malware
3. Target hardening index is _____ or higher.
Hint: Eighty
4. Run scans _____ to detect issues early.
Hint: Often/Scheduled
Backups are your insurance policy against data loss. Whether from hardware failure, ransomware, human error, or malicious attacks, having reliable backups ensures you can recover quickly.
1. Use _____ for efficient file backups.
Hint: Remote sync
2. mysqldump backups _____ databases.
Hint: Popular SQL database
3. Keep one backup _____.
Hint: Remote location
4. _____ backups periodically to ensure they work.
Hint: Verify
Complete these tasks before putting any server into production. This checklist represents the minimum security baseline.
1. Minimum target hardening index is _____.
Hint: Eighty
2. Set maxretry to _____ or less.
Hint: Three
3. Minimum password length should be _____ characters.
Hint: Twelve
4. Security is an ongoing _____, not a one-time task.
Hint: Continuous activity