Connect to Your Server via SSH on Windows

Unlike macOS or Linux-based distributions, Windows does not come with a built-in terminal application that you can use to access an Ubuntu server via SSH, using public/private key authentication. However, you can use an application called PuTTY to generate an SSH key and use it to connect to your server’s command line.

What is PuTTY ?

PuTTY is a free and open-source software application that provides a graphical user interface (GUI) for securely connecting to remote systems over networks. It is primarily used on Windows operating systems to establish SSH, Telnet, and serial connections to other devices such as servers, routers, and switches.

Here are key points about PuTTY:

1. SSH and Telnet Client

Regularly update your server's operating system (OS), web server software (like Apache or Nginx), database server (like MySQL or PostgreSQL), and other software components. Keep these up to date to patch vulnerabilities and ensure optimal security.

2. Key Features:

  • Secure Connections: PuTTY supports various encryption methods (e.g., SSH-2) to ensure secure communication over untrusted networks.

  • Terminal Emulation: PuTTY provides a terminal window where you can execute commands on the remote system as if you were directly logged into it.

  • Serial Console Support: PuTTY can connect to devices with serial ports, useful for managing network equipment and embedded systems.

  • X11 Forwarding: Allows remote graphical applications to be displayed locally when using SSH.

  • Session Management: PuTTY allows saving and loading connection settings for quick and easy access to different systems.

3. PuTTY Tools:

  • PuTTYgen: A key generator tool bundled with PuTTY that allows you to create and manage SSH keys for authentication.

  • PSCP: A command-line tool for securely transferring files between Windows and remote systems using SCP (Secure Copy Protocol).

  • PSFTP: A command-line tool for securely transferring files using SFTP (SSH File Transfer Protocol).

4. User Interface:

  • PuTTY provides a simple and straightforward graphical interface for configuring connections.

  • It allows customization of terminal settings such as font, colors, and window size.

5. Usage:

  • PuTTY is widely used by network administrators, system administrators, and developers for managing and troubleshooting remote systems.

  • It is especially popular in environments where secure access to Linux/Unix servers and networking devices is required from Windows machines.

PuTTY is a versatile and essential tool for anyone who needs to establish secure connections to remote systems from a Windows environment, offering reliable SSH and Telnet capabilities with a user-friendly interface.

Download and Install the PuTTY

To get PuTTY, browse this link https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html and download and install the latest version.

1. Use PuTTYgen to Generate Your SSH Key

PuTTY has a bundled PuTTYgen application that allows you to generate your public and private keys. The quickest way to run PuTTYgen on Windows 10 is to click the Start button, type putty, and then select “PuTTYgen” from the results.

2. Choosing a More Secure RSA Key Length in PuTTYgen

On Windows 10, PuTTYgen defaults to generating an RSA key of 2048 bits. For increased security, we recommend increasing this value to 4096.

3. Generate the Key Pair:

Click Generate. PuTTYgen will ask you to move the mouse over a selected area to generate the key.

4. Securing Your SSH Key with a Passphrase in PuTTYgen

Once the key generation has completed, PuTTYgen will populate the “Public key”, the “Key fingerprint”, and the “Key comment” values. At this point, entering and confirming a “Key passphrase” is a good idea. You’ll use the passphrase when you authenticate using this key.

First, click the Save private key button, and store the private key as id_rsa.ppk. You can save this anywhere on the computer, either on your desktop or in your Documents folder. Your private key file should be treated as you would a password and never shared with anyone. If you need someone else to access your server, follow the steps in this doc to create a separate private key for them.

You can also click the Save Public Key button to save the public key to a local file, but this is unnecessary.

5. Add the Public Key to Your WeWP Sudo User

→ Before you can connect to the server, you will need to add the public key you just generated to your server, and then attach it to a sudo user. When adding the public key, use the contents of the PuTTYgen “Public key” text area or use the contents from the public key file if you saved it at the previous step.

6. Connect Using the Private Key

Once you have added your public key to your WeWP server and assigned it to a sudo user, you can set up PuTTY to SSH into the server.

Open PuTTY and enter the server’s IP address in the “Host Name” field. If you have already configured your DNS and the domain name is pointing to the server, you can use that here.

7. Configuring SSH Authentication in PuTTY for Secure Connection

Then, navigate to Connection > SSH > Auth under the “Category” tree on the left-hand side of the PuTTY screen.

Click the Browse button, and select the id_rsa.ppk file you saved from PuTTYgen. You can then click Open to start the SSH session, which opens a terminal window.

8. Configuring SSH Authentication in PuTTY for Secure Connection

PuTTY will ask you to confirm if you would like to cache the server’s host key to your local registry. If you click Accept, the next time you connect, you won’t be asked this question again.

9. Logging into Your Server with PuTTY using SSH Key Authentication

You will be asked to enter the sudo user’s username to log into the server and the passphrase for the public key you specified at the generation step. If everything is configured correctly, you will successfully log into your server.

Last updated