Why Passwords Are Obsolete
Hackers use automated bots to guess millions of passwords every day (Brute Force Attacks). If you are using a standard password on your Dedicated Server, it is only a matter of time before you are targeted.
SSH Keys utilize cryptographic pairs (Public & Private) that are mathematically impossible to crack. By switching to keys and disabling passwords, you make your server "invisible" to login attackers.
Step 1: Generate Your Master Key
You must do this step on your Local Computer (Your Laptop/PC), not on the server.
Open your terminal (PowerShell on Windows, Terminal on Mac/Linux) and run:
ssh-keygen -t ed25519 -C "my-servermo-key"
We use ed25519 because it is faster and more secure than older RSA keys. Press Enter to save the file.
CRITICAL WARNING: Backup Your Key! β οΈ
Your Private Key is now the ONLY way to enter your server. If your computer crashes or you delete this file, you will be locked out forever.
Action: Copy your key file (usually in ~/.ssh/) to a secure USB drive or Cloud Storage immediately.
Step 2: Upload the "Lock" to Your Server
Now, send the Public Key to your ServerMO server. This tells the server: "Only the person with this key allows inside."
ssh-copy-id root@your-server-ip
You will be asked for your root password one last time. Once successful, try logging in:
Did it log you in without a password? If yes, proceed. If no, stop here and check your steps.
Step 3: The Kill Switch (Disable Passwords)
Now that your Key works, let's close the door on hackers by disabling password authentication completely.
Login to your server and edit the SSH config file:
nano /etc/ssh/sshd_config
Find and change these lines to match below:
PasswordAuthentication no
ChallengeResponseAuthentication no
PubkeyAuthentication yes
Save the file (Ctrl+O, then Enter) and exit (Ctrl+X).
Step 4: Restart & Verify (Do Not Close Window!)
Apply the changes by restarting the SSH service.
PRO TIP: Don't Lock Yourself Out! π
Do not close your current terminal window yet!
Open a NEW terminal window and try to login. If it works, great! If it fails, you still have your original window open to fix the configuration (set PasswordAuthentication yes temporarily).
What If I Lose My Key?
Since passwords are disabled, losing your private key means you cannot login via SSH. However, ServerMO has you covered:
- KVM/IPMI Console: You can access your server via the ServerMO Client Portal's KVM console (which acts like a physical monitor) to login and revert changes.
- Managed Support: Open a ticket, and our engineers can help verify your identity and reset access.
Final Thoughts
Congratulations! Your server is now immune to password brute-force attacks. While managing keys requires a bit more care (backups are essential!), the security benefits for your dedicated server are unmatched.
Need a secure server to practice on? Explore ServerMO Dedicated Servers β