Skip to content
A Smiling Quokka 微笑鼠
Updated Apr 27, 2026

Connect to a VPS from Scratch: SSH Login and Basic Hardening

A practical guide for first SSH login, creating a non-root user, disabling password login, and keeping common troubleshooting commands close at hand.

This article is the written companion to the video tutorial. Watch the video for context, then use this page to copy commands and follow the checklist.

Before You Start

  • An active VPS
  • The server public IP address
  • A local terminal
  • The initial root password or SSH private key

Before changing SSH settings, make sure your provider offers a rescue console. It gives you a recovery path if a configuration mistake locks you out.

First Login

Replace the IP below with your server address:

ssh root@203.0.113.10

The first connection asks whether you trust the server fingerprint. If the IP is correct, type yes.

Create a Non-Root User

Avoid using root for daily work. Create a regular user and add it to the sudo group:

adduser quokka
usermod -aG sudo quokka

Switch to the new user and test sudo:

su - quokka
sudo whoami

If it prints root, sudo is working.

Disable Password Login

Add your public key to the server:

mkdir -p ~/.ssh
nano ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Then edit the SSH configuration:

sudo nano /etc/ssh/sshd_config

Confirm these settings:

PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes

Keep the current terminal window open. Start a second terminal and test the new login before closing anything.

sudo systemctl restart ssh
ssh quokka@203.0.113.10

Common Issues

IssueWhat to Check
Connection timeoutFirewall, security group, incorrect IP
Permission deniedPublic key content and file permissions
sudo unavailableWhether the user is in the sudo group