How To Use PuTTY SSH to Connect to a Remote Server in Linux?

November 12, 2022
Hello, readers! What are you seeking if you're looking for an exciting topic for you and your project, you've come to the perfect place. If you don't know How To Use SSH to Connect To a Remote Server On Linux? we will all clear your queries and worries in the following post.
Secure Shell, also known as Secure Socket Shell, is a text-based protocol that allows you to securely connect to a remote computer or server. Simon Tatham created the PuTTY SSH and telnet client for the Windows platform. PuTTY is open-source software with source code that is developed and maintained by a group of volunteers.
When you establish a secure SSH connection, a shell session is launched, and you can modify the server by typing commands into the client on your local computer.
This protocol is most commonly used by the system and network administrators, as well as anyone who needs to remotely administer a computer in a very secure manner.
how-to-use-putty-ssh-to-connect-to-a-remote-server-in-linux

Prerequisites

There are a few basic prerequisites to complete before you can establish secure remote desktop communication with a distant machine:
   ⦁ The remote computer must be turned on and connected to the network at all times.
   ⦁ Both the client and server programs must be installed and activated.
   ⦁ You will need the IP address or name of the remote machine to connect to.
   ⦁ To access the remote computer, you must have the proper rights.
   ⦁ The remote connection must be permitted by the firewall settings.

How Does SSH Function?

An SSH connection requires two components: a client and the matching server-side component. An SSH client is a program that you install on your computer and use to connect to another computer or a server. The client initiates the connection using the specified remote host information and, if the credentials are verified, establishes the encrypted connection.
An SSH daemon is a component on the server that is continually listening to a certain TCP/IP port for possible client connection requests. When a client makes a connection, the SSH daemon responds with the software and protocol versions it supports, and the two exchange identity information. SSH establishes a new session for the appropriate environment if the credentials are correct.
Version 2 is the default SSH protocol version for SSH server and SSH client communication.

How to Configure an SSH Connection?

Because an SSH connection requires both a client and a server component, you must ensure that both are installed on the local and remote machines. OpenSSH is an open-source SSH utility that is commonly used in Linux distributions. Installing OpenSSH is a simple process. It necessitates access to the server's terminal as well as the computer used for connecting. It should be noted that the SSH server is not installed by default in Ubuntu.

Installing an OpenSSH Client

Make sure that an SSH client is not already installed before proceeding. SSH clients are already included in many Linux distributions. To connect to a server on a Windows system, install PuTTY or another client of your choice.
To see if the client is accessible on your Linux-based machine, do the following:
Launch an SSH terminal. You can either search for "terminal" or use the CTRL + ALT + T keyboard shortcut.
In the terminal, type ssh and press Enter.
If the client is installed, you will receive the following response:
username@host:~$ ssh
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]
username@host:~$
This implies you're ready to connect to a physical or virtual machine remotely. Otherwise, you'll need to download and install the OpenSSH client:
   1. To install the OpenSSH client on your PC, use the following command:
           install OpenSSH-client with Sudo
   2. When prompted, enter your superuser password.
   3. To finish the installation, press Enter.
You can now SSH into any machine that has the server-side program installed, as long as you have the proper privileges and the hostname or IP address.

Installing an OpenSSH Server

To accept SSH connections, a workstation must have the server-side component of the SSH software toolkit installed.
To see if the OpenSSH server is present on the Ubuntu system of the remote machine that wants to allow SSH connections, connect to the local host:
   1. Start the server machine's terminal. You can either search for "terminal" or use the CTRL + ALT + T keyboard shortcut.
   2. Enter the command ssh localhost.
   3. The response for systems that do not have the SSH server installed will look like this:
username@host:~$ ssh localhost
ssh: connect to host localhost port 22: Connection refused username@host:~$

If this is the case, you must install the OpenSSH server. Keep the terminal open and do the following:
   1. To install the SSH server, use the following command:
         sudo apt-get install OpenSSH-server ii.
   2. When prompted, enter your superuser password.
   3. Enter and Y to continue the installation following the disc space prompt.
The necessary support files will be installed, and you can then use the following command to see if the SSH server is functioning on the machine:
      sudo service ssh status
If the SSH service is now operational, the terminal response should look like this:
 username@host:-$ sudo service ssh status
• ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: active (running) since Fr 2018-03-12 10:53:44 CET; 1min 22s ago Process: 1174 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES
Main PID: 3165 (sshd)
Another approach to see if the OpenSSH server is fully installed and accepting connections is to run the ssh localhost command again in your terminal prompt. When you run the command for the first time, the response will look like this:
username@host:~$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established. ECDSA key fingerprint is SHA256:9jqmhko9Yo1EQAS1QeNy9xKceHFG5F8W6kp7EX9U3Rs. Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
username@host:~$
To proceed, enter yes or y.
Congratulations! You've configured your server to accept SSH connection requests from another machine using an SSH client.

TIP

You can now modify the default port for SSH connections by editing the SSH daemon configuration file. Run the following command from the terminal prompt:
sudo nano /etc/ssh/sshd_config
The configuration file will open in your preferred editor. We utilized Nano in this example.
If you need to install Nano, use the following command:
sudo apt-get install nano
Please keep in mind that you must restart SSH service after making any changes to the sshd config file by performing the following command:
sudo service ssh restart

Final Wording:

The methods and processes outlined in this article will work for the majority of users and most versions of Linux and Windows.
You should now be able to connect to a remote server using Linux or Windows.
There are numerous additional ways to connect two remote computers, but the ones discussed here are the most frequent.
Thank you for reading!

Monthly Newsletter
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.