How to Secure Your Server: Essential Security Guide

Change SSH port, disable root login, configure UFW, install fail2ban — 6 essential steps in 15 minutes.
First 15 Minutes After Receiving Your Server
You got root credentials for your new server. Before doing anything else — secure it. An unsecured server = an open door on the internet.
Here are 6 essential steps you can complete in 15 minutes.
Step 1: Update the System
First command to run:
apt update && apt upgrade -y # Ubuntu/Debian
# or
dnf update -y # AlmaLinux/Rocky
Updates patch known vulnerabilities. 60% of breaches exploit vulnerabilities with available patches — that were never installed.
Step 2: Create New User and Disable Root
Never use root for daily work. Create a new user:
adduser admin
usermod -aG sudo admin
Then disable root SSH login:
# In /etc/ssh/sshd_config
PermitRootLogin no
Step 3: Change SSH Port
Default port 22 gets thousands of attempts daily. Change it:
# In /etc/ssh/sshd_config
Port 2222 # or any number between 1024-65535
After editing:
systemctl restart sshd
Result: 99% of automated attack attempts disappear.
Step 4: Configure Firewall (UFW)
UFW simplifies firewall management:
ufw default deny incoming
ufw default allow outgoing
ufw allow 2222/tcp # SSH (new port)
ufw allow 80/tcp # HTTP
ufw allow 443/tcp # HTTPS
ufw enable
Rule: Only open ports you need. Block everything else.
Step 5: Install fail2ban
fail2ban blocks IPs with failed login attempts:
apt install fail2ban -y
systemctl enable fail2ban
systemctl start fail2ban
Default: 5 failed attempts = 10-minute ban. Configurable to your needs.
Step 6: Enable Automatic Updates
apt install unattended-upgrades -y
dpkg-reconfigure -plow unattended-upgrades
This ensures security updates install automatically — without forgetting.
Additional Important Steps
SSH Keys Instead of Passwords
# In /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
Enable 2FA
Google Authenticator on SSH adds a second protection layer.
System Monitoring
apt install logwatch -y
Logwatch sends daily reports of suspicious events.
Quick Checklist
- [ ] System update
- [ ] Create user + disable root SSH
- [ ] Change SSH port
- [ ] Configure UFW
- [ ] Install fail2ban
- [ ] Enable automatic updates
- [ ] SSH Keys
- [ ] Monitor logs
Bottom Line
15 minutes of security setup protects you from 99% of common threats. A secure server is not luxury — it is foundation.
Get Started
Need a secure environment? Choose a protected server with DDoS protection and advanced firewall. Review our SLA and Privacy Policy.


