Setting Up Secure SSH Access with PuTTY and Personal Keys

SSH (Secure Shell) is a critical component of server management, allowing secure remote access to your Ubuntu Server. However, to enhance security, it’s essential to configure SSH properly. In this guide, we will explore how to set up secure SSH access using PuTTY and personal keys, strengthening your server’s defenses against unauthorized access.

Introduction to SSH and PuTTY

SSH is a cryptographic network protocol that enables secure data communication between a client and a server. It’s commonly used for remote administration, file transfers, and tunneling.

PuTTY, on the other hand, is a widely used SSH and Telnet client for Windows. It provides an easy-to-use interface for connecting to remote servers securely.

Installing PuTTY on Windows

If you’re using Windows as your local machine, you’ll need to install PuTTY. You can download the latest version from the official website here.

  1. Download the PuTTY installer package suitable for your Windows architecture (32-bit or 64-bit).
  2. Run the installer and follow the on-screen instructions to complete the installation.

Generating SSH Key Pairs

SSH keys consist of a public key and a private key. The public key is stored on the server, while the private key is kept on your local machine. Here’s how to generate a key pair:

  1. Open PuTTYgen: Launch PuTTYgen from your Start menu after installing PuTTY.
  2. Generate a Key Pair: Click the “Generate” button to create a new SSH key pair. Move your mouse cursor within the PuTTYgen window to generate randomness for the keys.
  3. Save Your Keys: Once the key pair is generated, you can set a passphrase for added security. Afterward, click “Save private key” to save the private key to your local machine and “Save public key” to save the public key.Note: Keep your private key secure and never share it. It is the key to your server.

Configuring SSH Server on Ubuntu

Before using SSH keys for authentication, you’ll need to configure your SSH server on the Ubuntu Server to accept key-based authentication.

SSH into Your Server: Connect to your server using your preferred method (e.g., password-based authentication).

Edit SSH Configuration: Open the SSH configuration file for editing with the following command:

sudo nano /etc/ssh/sshd_config 

Ensure the following settings are configured:

PasswordAuthentication noPubkeyAuthentication yes

Restart SSH Service: Save your changes and exit the text editor. Then, restart the SSH service to apply the new configuration:

sudo systemctl restart ssh

In the next section of this blog post, we will explore how to authenticate with SSH keys and disable password-based authentication for enhanced security. Stay tuned for the continuation of this guide!