How to SSH terminal through MobaXterm and PuTTY in Windows?
Last updated
Last updated
The ability to access devices remotely is so essential that we now find it difficult to imagine life without it. This ability has become so ingrained in our lives that we take it for granted. Depending on the OS you are using, there are a variety of ways to connect to a remote workstation of which SSH is predominantly used. Secure Shell, or SSH, is a technology used to log onto remote servers securely. It is the preferred method for gaining access to remote Linux servers.
In this tutorial, we will learn how to connect SSH remotely with MobaXterm and PuTTY.
Ubuntu 20.04
Remote Linux server
Internet connection
Step 1: Installing MobaXterm
If you don’t have MobaXterm already installed, you may download the latest version of MobaXterm from the official repository, where you have the option of using Home Edition, which is freely available or Professional edition, which has a paid plan per user.
Step 2: Running MobaXterm
Once installed, run the MobaXterm application.
Step 3: Locating SSH
i. From the menu bar, click on Session, as shown in the image below.
A window will prompt, containing several connection options like SSH, RDP, Telnet, FTP, SFTP, Shell etc. and asking you to choose a session type.
ii. Now, click on SSH from the prompted menu.
The SSH connection window is active now, you just need to specify the connection particulars to go ahead.
Step 4: Setting up the Configurations for Connection
i. Enter Remote host address (IP address), Specify username (you may leave it to default as well), and port number (by default port number is 22), as explained below:
Remote host: Enter the Internet Protocol address that ensures your device's connection with the remote server.
Username- Fill in the name of your instance image. You can rename it later on with the root privileges. Also, keep in mind that these usernames are case-sensitive.
Port number- When a message from the internet or another network enters a server, a port number can be used to specify the particular process to which the message should be delivered.
ii. Check the box of Use private key and then browse your computer to select the already saved private key pair, which you used during the instance creation. If you are facing an issue with the private key creation, check this.
iii. After selecting the private key pair file, click OK.
If you see the login screen, as shown below, that means you are successfully connected to the server.
Step 7: Connecting the Terminal
Fill in your username i.e. name of your instance image for example- ubuntu, debian, etc. If you have chosen the specific username in Step 5, your server will automatically get connected. Therefore, you may skip this step.
You are now connected to your server, start entering the desired commands to proceed.
For establishing a connection through Putty, you need Putty Key Generator as well. PuTTYgen is a utility that generates SSH keys for PuTTY. Similar to the ssh-keygen utility used in various other SSH implementations. Creating public and private key pairs is the principal function of PuTTygen.
PuTTY uses its own format to store keys, often called .ppk files. However, the utility has the option of several conversion options into other file types.
Step 1: Download PuTTY
You may download Putty from the official Putty repository. Moving forward, in the Alternative binary files section, select and download the appropriate putty.exe file, which is suitable to your Operating system.
.exe extension depicts the executable file, which can run on your computer like an application and hence proves to be an easier way for the user.
Step 2: Run PuTTY Key Generator
PuTTYgen generally comes pre-installed with the PuTTY.exe package, so you need not download separately. If in case of some issue, you may download it from here.
Step 3: Loading existing key pair for Authentication
As you must have generated a private key pair, while creating your instance, you do not need to generate a new one.
Click on Load, to load an already created existing key pair from your computer.
ii. To access all the types of files from your computer, you need to click on the down arrow key and select All files (*.*) option. As PuTTY Key Generator has .ppk (PuTTY Private Key Files) extension and it only shows .ppk files by default. Moving on you may search for your private key by entering the File name in the search bar.
Step 4: Generating Private key in .ppk format
As soon as your saved private key gets loaded, PuTTYgen displays a message in a pop-up window giving the instructions for using it with the PuTTY with a suitable format. Below attached image has the appropriate highlights in red for your reference:
Click Ok on the PuTTYgen Notice message.
For creating a new key pair, select the kind of key to generate from the bottom of PuTTY Gen's screen. For the majority of users, SSH-2 RSA with a 2048-bit key size is recommended. Another well-known alternative is ECDSA, which is a suitable option because of its smaller key length and efficient security.
ii. Click on Generate.
Putty uses randomness to generate uniqueness in the key. Therefore, you are required to hover your mouse over the Puttygen window. As the exact movement of the hovering mouse cannot be predicted, this process of moving mouse is done to protect it from hackers and attackers. This process of key generation takes time according to the size of the key from a few seconds to several minutes.
As the green bar advances, the process comes to an end.
Step 5: Saving the private key
You may set a passphrase or password to protect your newly created private key. If you do not wish to set any password, just click Yes in the PuTTYgen warning window, as done in the image below.
ii. Save your private key with a unique name.
iii. Don’t forget to set the file type as .ppk format, if not chosen directly by the software application.
Step 6: Configuring PuTTY for secure connection
There are numerous options available in the initial setting window. For typical use, the majority of them are not required. The following are the main areas you need to look upon. These fields are marked red for your reference:
HostName: Hostname or IP address is a unique address that provides identification to a device on the internet or the local network. With a known hostname or IP address, you should be able to SSH into any machine that has the server-side programme on it.
Fill in your server’s IP address.
Port field: The connection's TCP/IP port is specified in the port field. The port is used for Secure Shell Communication and enables remote operation of the desired VM (Virtual Machine). The default port value remains 22, but can be altered and assign a different port, if you need to connect to a different port for any reason or in case of running multiple servers simultaneously.
ii. Type in the desired port number, on which you want the SSH connection.
Type of Connection: Among the given connection options, you need to stick-on to the SSH connection. SSH is a safe, encrypted communication technology that is intended to keep your data and password as safe as possible.
iii. By default, the connection type is SSH, so you need not make any changes here.
Step 7: Loading .ppk Private Key in PuTTY
Moving forward, we need to upload the private key that we created using PuTTY Key Generator in Steps 3 to 5 above.
Note: Refer to the consecutively attached screenshots, highlighted in red, for your reference in each step.
You may easily find the category field in the left navigation menu, scroll down and click on SSH.
From the sub-options, below SSH, click on Auth.
Below Auth, click on the Credentials, now you must be prompted to an authentication page with credentials.
iv. In the private key section, click on Browse, which will open up your local computer’s browsing window.
v. Select your saved .ppk private key file, which you generated with Putty Key Generator.
vi. After filling up all the required details, click Open.
Step 8: Logging in to the instance
Now you are successfully connected to your SSH server, as shown in the below image. You just need to enter your instance image name to continue.