Connecting via SSH using the Putty key
This tutorial provides step-by-step instructions on how to install PuTTY SSH, use it, and configure key-based authentication. By following these instructions, you will be able to establish a secure connection to a remote server using PuTTY.
The challenges faced today
Business environments today often run multiple operating systems. Consider workstations and servers. Network devices, Linux servers, IoT systems, and Linux workstations may need to be connected to a Windows workstation. Securely connecting these environments and protecting data are the challenges faced these days. A tool like PuTTY can assist with this.
SSH - what is it?
Secure Shell or Secure Socket Shell (SSH) is a network protocol that allows users to access computers securely over unsecured networks, especially for system administrators.
The SSH protocol is also implemented through a suite of utilities. Using Secure Shell, you can securely communicate between two computers over an open network, such as the Internet, using strong password authentication and public key authentication.
Network administrators use SSH to access another computer remotely, execute commands, and move files between computers as well as to provide strong encryption.
Using SSH, you can securely access a computer or device over an insecure network. SSH connections can be used to configure Linux servers and network devices remotely.
What is PuTTY?
Sysadmins rely on SSH (Secure Shell) to establish secure connections with remote devices, empowering them to perform various tasks efficiently. Here are some of the key activities sysadmins carry out using SSH:
1. Audit Log Files in var/log:
By connecting to remote devices via SSH, they can navigate to the var/log directory and analyse log files to identify any anomalies or potential problems.
2. Edit Configuration Files in /etc:
Sysadmins utilise SSH to access the /etc directory and modify these files as needed.
3. Update Software using DNF or APT:
With SSH, they can leverage package managers like DNF (Dandified Yum) or APT (Advanced Package Tool) to download and install updates seamlessly. This allows sysadmins to keep systems up-to-date with the latest security patches, bug fixes, and feature enhancements.
4. Connect to Network Devices:
SSH serves as a crucial tool for sysadmins to connect to various network devices, including routers and managed switches.
5. Enable or Disable Switch Ports:
Sysadmins often need to enable or disable individual switch ports to manage network connectivity efficiently.
6. Manage Routing Tables:
Sysadmins can utilise SSH to connect to routers and managed switches, gaining access to routing table configurations.
7. Configure Routing Protocols Remotely:
SSH enables sysadmins to remotely configure routing protocols on network devices. Whether it's OSPF (Open Shortest Path First), BGP (Border Gateway Protocol), or EIGRP (Enhanced Interior Gateway Routing Protocol), they can establish SSH sessions to routers and switches and modify routing protocol settings.
How to install PuTTY
First you need to install the PuTTYGen utility, available at this link
To install PuTTY on your Windows system, follow these simple steps:
1. Start by selecting the appropriate package file for your system. You have three options depending on your system architecture: 64-bit x86, 64-bit Arm, or 32-bit x86.
2. Once you have identified the correct package file, proceed to download the installation executable. Make sure to save it to a location on your computer where you can easily access it.
Next, run the utility and click the Generate button. During key generation, the program will notify you that you need to perform random actions (like moving the cursor) to generate a random sequence. As a result, public and private keys will be generated.
- Use the "Save private key" and "Save public key" buttons to save the keys on your computer. As a precaution, you can save the key by setting a password on it.
Next, you need to add a public key to the server to which you plan to connect.
- To do this, connect to it via SSH, using the password, and open the file .ssh / authorized_keys in the user's home directory.
The following entry must be added to the end of the file.
In this example, the plan is to connect with the root account, so the path to the file /root/.ssh/authorized_keys
You can see the contents of the key in the file itself, this part is highlighted in the screenshot.
Then in the Putty window go to the "Connection" tab → "SSH" → "Auth" and in the bottom field specify the path to the private key file (has a * .ppk extension)
- After that, enter the server address on the main tab of the program and connect.
When connecting, the program will ask for the name of the user with which you plan to log in.
Enter the name of the account for which you previously entered the key (in our case, root), and then gain access to the console.
If the key was saved with a password - after entering the login, you will need to enter the password from the SSH-key (it may be different from the account password)