Before you deploy your website or application, securing your VPS should be your top priority.
Here are the most important security practices to keep your Linux server safe and stable.
1️⃣ Disable Root Login
Edit the SSH configuration file:
nano /etc/ssh/sshd_config
Find and modify:
PermitRootLogin no
Then restart SSH:
systemctl restart ssh
2️⃣ Create a Normal User with Sudo Privileges
adduser admin
usermod -aG sudo admin
3️⃣ Use SSH Keys for Login
On your local machine, generate an SSH key pair:
ssh-keygen -t rsa
Upload the public key to your VPS:
ssh-copy-id admin@your-server-ip
Now you can log in securely without a password.
4️⃣ Enable a Firewall (UFW)
apt install ufw -y
ufw allow 22/tcp
ufw allow 80/tcp
ufw enable
This limits access to only necessary ports.
5️⃣ Enable Automatic Security Updates
apt install unattended-upgrades -y
dpkg-reconfigure --priority=low unattended-upgrades
This ensures your system receives critical patches automatically.
6️⃣ Monitor Suspicious Processes
top
ps aux --sort=-%mem | head
Use these commands to detect unusual memory or CPU usage.
✅ Recommended Setup
- Tudcloud USA VPS — includes 20Gbps DDoS protection
- Linux + SSH Key + Firewall
- Regular backups or snapshots
🧩 结论
Security should always come first.
By following these best practices, you’ll keep your VPS secure, reliable, and ready for production use.