What You Need
- The server's IP address
- A user name, which is usually root on a new server
- The password, or an SSH key
- The SSH port, which is 22 unless it was changed
Connect with PuTTY
- Download PuTTY from its official website and open it.
- Enter the server's IP address in the Host Name field.
- Leave the port at 22 and the connection type at SSH.
- Click Open. On the first connection PuTTY shows the server's host key; accept it to continue.
- Type the user name and press Enter, then type the password. Nothing appears on screen while you type the password.
To paste text into the PuTTY window, right-click in it.
Connect with the ssh Command
macOS, Linux, and current versions of Windows include an SSH client. Open a terminal and run:
ssh root@your_server_ip
If the server uses another port, name it with -p:
ssh -p 2222 root@your_server_ip
Log In with an SSH Key
An SSH key is a pair of files that replaces the password: the private key stays on your computer, and the public key goes on the server. To create a key pair:
ssh-keygen -t ed25519
On macOS and Linux, copy the public key to the server with:
ssh-copy-id root@your_server_ip
For PuTTY, keys are created with PuTTYgen and selected in PuTTY under Connection, SSH, Auth.
Common Connection Errors
| Error | Likely cause |
|---|---|
| Connection refused | The SSH service is not running, or the port is wrong. |
| Connection timed out | The IP address is wrong, the server is off, or a firewall blocks the port. |
| Permission denied | The user name, password, or key is wrong. |
| Host key verification failed | The server was reinstalled and its key changed; remove the old key from your known hosts file. |
First Steps After You Log In
- Update the system packages.
- Create a regular user and use sudo instead of working as root.
- Set up SSH keys and turn off password login.
- Enable a firewall and open only the ports you need.