P r o f i a d

Connect to a Remote Server Using Putty on Windows 💻

PuTTY is an application which lets you securely connect to a remote server using the Secure Shell (SSH) Protocol.

SSH uses public-key cryptography (new blog post) to securely log in and execute commands on a remote machine, usually running a Linux distribution.

Why use PuTTY?

PuTTY is free and it provides an easy to use interface which allows you to quickly connect using private-keys stored on your local machine. PuTTY also comes with Pageant (PuTTY Authentication Agent) which saves you having to enter a private key’s passphrase each time you log in (new blog post).

Step 1: Download and Install PuTTY

Visit putty.org and click on the download “here” link:

Screenshot from Download PuTTY page on putty.org

This will take you to the installer files page, where you can select either the 32-bit or 64-bit based on your Windows OS:

Screenshot of PuTTY windows installer files on putty.org

Step 2: Connect using root account

Once installed, open up PuTTY:

Screenshot of PuTTY in the Windows Start menu

Now it’s time to get your remote server details. In this example we’ll be using a new Ubuntu instance on Digital Ocean, but this could be any remote or cloud server provider, eg. AWS or Google Cloud. It could even be a your Raspberry Pi.

Now enter the IP address you’re connecting to. The default port used by SSH is 22:

Next, click on Open.

this will bring up this warning, this is because we are connecting without using encryption keys:

Enter ‘root’ as the username and your remote machine’s default password:

Hint: To paste in PuTTY, just right click your mouse anywhere under the cursor (useful for long initial passwords!)

On your first login you will be required to change your password:

Hint: if you need to change your password any other time use the passwd command

Step 3: Add a new user account Up to now we only have a root user account on this server. Generally we don’t want to be logging in with a root account as this any applications built using a root account will be given full administration privileges, which could lead to serious issues if our app has a security breach.

In order to add a new user account we can use the adduser command, for example:

adduser evan Now enter your new password and fill in the details requested eg. Full Name etc.

Step 4: Give the new account administrator privileges If we want to install packages on our server using this new account we need to give this account root (sudo) privileges. To do this we need to update the /etc/groups file.

To do this we will use the Nano text editor which comes with Linux:

cd /etc nano group In this file, look for the line sudo:x:27: and add your new username to this line eg.

sudo:x:27:evan Press Ctrl+o then Enter to save then Ctrl+x to exit the file.

Hint: if you have more than one account which need root privileges, add them one after another separated by a comma eg. sudo:x:27:evan,tom,jerry

We can now run commands with root privileges when logged in to our new account by specifying sudo in front of the command eg. >sudo apt-get update

You are now logged in to your server and have a new user account which can run commands with root privileges.

Right now, anyone who knows our username and password can log in to our server therefore the next step is to set up authentication keys which will improve security.