Save 10%Pay yearly on any plan. 6% half-yearly, 3% quarterly. Help centreWhatsAppTelegram TeamsOpen a ticket

How to Connect to a Linux VPS with PuTTY

Connect to a Linux server from Windows with PuTTY: download it safely, enter the address, accept the host key, log in, save the session, add a key.

4 min readBy Swati

Reviewed by the AmazingRDP technical team

Connecting to a Linux VPS with PuTTY

Need a server to connect to? A Linux VPS gives you root access over SSH. See Linux VPS from $6.99

PuTTY is a small, free program that opens an SSH session from Windows to a Linux server. You type commands on your PC; they run on the server. Windows now has an SSH client built in, and the comparison of SSH clients explains when that is enough. PuTTY remains popular because it saves sessions with all their settings and runs on any Windows version. Here is the whole path from download to a saved, key-based login.

What you need

  • The server's IP address.
  • The user name, usually root on a new VPS.
  • The password.
  • The SSH port, 22 unless your provider says otherwise.

All four are in the email you received when the server was set up, and in the client area.

Step 1: download PuTTY from its own site

PuTTY's home is on its author's site at chiark.greenend.org.uk; searching for "PuTTY" also turns up advertising pages that have carried tampered copies. Take the 64-bit installer (.msi), which also installs the companion tools PuTTYgen and Pageant. It is in the Microsoft Store as well.

Step 2: enter the connection details

  1. Start PuTTY. The Session page opens.
  2. Host Name (or IP address): the server's address.
  3. Port: 22, or the one you were given.
  4. Connection type: SSH.
  5. Click Open.

Step 3: accept the host key

At the first connection PuTTY shows a security alert with the server's key fingerprint. This is expected: PuTTY has never seen this server. Click Accept to remember the key.

If the alert appears again later for the same server, with the words "potential security breach", PuTTY is telling you the server's key has changed. After a reinstallation of the server that is normal. Otherwise, do not continue until you know why.

Step 4: log in

  1. At login as: type the user name and press Enter.
  2. Type the password and press Enter. Nothing appears while you type, not even dots. That is normal.

To paste a password, click the right mouse button once in the window. You are in when you see a prompt such as root@server:~#.

Step 5: save the session

So that you need not type the address again:

  1. Fill in the Session page as in step 2.
  2. Under Connection, Data, enter the user name in Auto-login username.
  3. Under Connection, set Seconds between keepalives to 30, so that idle sessions are not dropped.
  4. Back on Session, type a name under Saved Sessions and click Save.

Next time, double-click the name. PuTTY does not store passwords, which is a good thing.

Copy and paste in PuTTY

ToDo
Copy from the windowSelect the text with the mouse; it is copied at once
Paste into the windowRight-click, or Shift + Insert
Stop a running commandCtrl + C (which does not copy here)
End the sessionType exit

First commands on a new server

passwd
apt update && apt upgrade

The first changes the password you were sent. The second installs updates on Ubuntu and Debian (dnf upgrade on the Red Hat family).

Step 6: log in with a key

A key is safer than a password and saves typing.

  1. Start PuTTYgen, choose EdDSA (Ed25519), click Generate and move the mouse.
  2. Enter a passphrase and click Save private key. Keep the .ppk file to yourself.
  3. Copy the text in the box Public key for pasting into OpenSSH authorized_keys file.
  4. On the server, in your PuTTY session:
mkdir -p ~/.ssh && chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

Paste the key as a single line, save and close.

  1. In PuTTY, load your saved session, go to Connection, SSH, Auth, Credentials, and choose the .ppk file as the private key. Save the session again.
  2. Connect. PuTTY asks for the key's passphrase in place of the server password.

Test the key login in a second window before changing anything else. More detail, with pictures, in generating an SSH key in Windows; switching password logins off is in SSH hardening.

Problems

MessageCause
Network error: Connection timed outWrong address or port, a firewall in between, or the server is off. Check it in the control panel
Network error: Connection refusedThe server is reachable, but nothing listens on that port: wrong port, or the SSH service is stopped. See the SSH port
Access deniedWrong user name or password, or password login is switched off
Server refused our keyThe public key is not in authorized_keys, was pasted over several lines, or the file's permissions are too open
Software caused connection abortThe connection was idle or interrupted. Set keepalives (step 5)
Strange characters in menusUnder Window, Translation, set the character set to UTF-8

Moving files

PuTTY is a terminal only. For files, use WinSCP, which can import your PuTTY sessions, or the command-line tool pscp that is installed with PuTTY. From a Mac the built-in terminal does the same job: see SSH on a Mac. For a server to practise on, see our Linux VPS plans.

Questions

How do I connect to a Linux VPS with PuTTY?

Enter the server's IP address and port 22 in PuTTY, click Open, accept the host key, then type the user name and password.

Why can I not see my password when typing in PuTTY?

SSH never shows the password, not even as dots. Type it and press Enter.

How do I paste in PuTTY?

Right-click in the window, or press Shift + Insert.

What does "Connection refused" mean in PuTTY?

The server answered, but no SSH service is listening on that port. Check the port number and that the service is running.