Once you have successfully connected to your VPS using SSH, your server is accessible but not yet secure or production-ready.
This article explains exactly what to do next, step by step, in the correct order.
You are logged into your VPS
You see a prompt like:
root@your-server-name:~#OS: Ubuntu 20.04 / 22.04
Updating the server ensures:
Security patches are applied
System packages are up to date
Fewer bugs and vulnerabilities
Run:
apt update && apt upgrade -yThis may take a few minutes.
Using root for daily work is not recommended.
adduser deployYou will be asked to:
Set a password
Enter optional details (you can press Enter to skip)
usermod -aG sudo deployNow deploy can run admin commands safely.
Switch to the new user:
su - deployCreate SSH folder:
mkdir ~/.ssh
chmod 700 ~/.sshCopy SSH key from root user:
cp /root/.ssh/authorized_keys ~/.ssh/
chmod 600 ~/.ssh/authorized_keysExit back to root:
exitThis step greatly improves security.
nano /etc/ssh/sshd_configPermitRootLogin no
PasswordAuthentication noSave:
CTRL + O → Enter
CTRL + X
systemctl restart ssh⚠️ Do NOT close your SSH session yet
First, test login with the new user.
From your PC terminal:
ssh deploy@YOUR_SERVER_IPExample:
ssh [email protected]If login works ✅
You can safely stop using root.
Task | How Often |
|---|---|
SSH key generation | Once |
Add SSH key to VPS | Once |
Server updates | Weekly |
SSH login | Daily |
VPS web console | Emergency only |
Root login | Disabled |
ssh deploy@YOUR_SERVER_IP(Not root, for better security)
After this, you may also:
Enable firewall (ufw)
Change SSH port
Install fail2ban
Set up automatic security updates
After your first VPS connection:
Update the server
Create a non-root user
Secure SSH access
Disable root login
Use SSH normally every day
Your VPS is now secure, stable, and production-ready