
This article explains how to connect to a remote server under Linux using SSH. We also go through how to connect to a distant Linux server using PuTTY. PuTTY is not the only SSH client available for remote connections, of course. View this comparison of the top SSH clients for Windows in 2022, then pick the one that best suits your needs. It has long been necessary to access equipment remotely, and we can hardly conceive how life would be without the ability to control computers from a distance.
Depending on the operating system you’re using, there are a number of ways to connect to a remote machine, but the two most popular ones are:
- Linux-based devices can use Secure Shell (SSH).
- RDP is the Remote Desktop Protocol for Windows-based devices.
Both protocols make use of server and client software to establish remote connections. These tools give you access to and remote control over other computers, data transfer, and practically everything else you can do when physically in front of a computer.
What Does the SSH Stand for and What Is It?
SSH (Secure Shell), sometimes known as “Secure Socket Shell,” is a protocol that enables secure text-based connections to servers or remote devices. SSH and RDP are the two most popular protocols for connecting to a distant system. A client and a server are required to establish an SSH connection.
Once a secure SSH connection has been established, a shell session will start, allowing you to issue commands through the local client to control the server. This protocol is used by system and network administrators in particular to access a device remotely in a very secure manner.
How Does SSH Function?
The client and the appropriate server-side component are required to establish an SSH connection. T When connecting to a different computer or server, an application called the SSH client is running on the device you’re using. The client establishes the connection using the information the remote host provides. The client establishes an encrypted connection when the credential has been verified.
The SSH daemon (SSHD), a component on the server, is always listening to a particular TCP/IP port for prospective client link requests. The SSH daemon will respond with the software and protocol versions it supports if a client has initiated a connection, and the two will exchange their unique identifiers.
The correct environment will be selected for a new SSH session if the received credential is correct. Version 2 of the SSH protocol is the standard for SSH server and SSH client communication.
How Do Terminals Work?
You should familiarise yourself with the terminal if you’re new to Linux. Consider it the ultimate command shortcut hub that serves as the default means of interacting with a Linux server.
Using the command line may appear to be a difficult task, but it’s easy if you start with the fundamentals, such as these 15 fundamental commands every user should be familiar with.
If you intend to create an application (or are learning to create one) using Python or PHP, the terminal becomes even more important. Linux incorporates Python and other programming languages into the terminal, in contrast to Windows, which messes up trying to reproduce Python with a GUI. Therefore, even though installing Python on Windows requires a few steps only to result in a jumbled mess, Linux already has it installed and is command-line accessible.
Describe SSL.
Secure Socket Layer, or SSL, is a protocol that SSH employs to encrypt data sent between a web browser and a server. With SSL, the connection between a web server and a browser is encrypted, guaranteeing the privacy and security of any data exchanged between them. In other words, the SSL security protocol includes the creation of public and private keys between remote servers and local PCs connected via SSH. This additional degree of security is beneficial, especially when dealing with brute-force password attempts.
How can I establish an SSH connection?
You must ensure that both the client and the server components are installed on both the local and remote machines in order to establish an SSH connection.
OpenSSH is a widely used and user-friendly open-source SSH utility for Linux distributions. It requires access to both the connecting device and the server’s terminal. Please be aware that an SSH server is not installed by default on Ubuntu. We now have a solid understanding of SSH and topics that are related to it, so let’s get started on setting up an OpenSSH client.
STEP1- Setup the OpenSSH client
Make sure the SSH client is not already installed on your machine before installing it. SSH clients are already included in many Linux distributions.
1.Run the following command to install OpenSSH on your device:
sudo apt-get install openssh-client
2.Once necessary, enter the superuser password.
3.To complete the installation, press Enter.
STEP2-:Install an OpenSSH Server
The server-side component of the SSH software toolkit must be installed on the computer in order for it to accept SSH connections. The steps below must be followed in order to accomplish this:
1.Launch the server machine’s terminal. Either find a terminal or use the keyboard shortcut CTRL + ALT + T.
2.To set up your SSH server, type the following command:
sudo apt-get install openssh-server
3.Once necessary, enter the superuser password.
4.After the disc space prompt, hit Enter and Y to let the installation proceed.
You can check whether the SSH server is operating on the machine by executing the following command after you have completed the aforementioned procedures and have the necessary support files installed for you:
sudo service ssh status
If the SSH service is functioning as intended, the terminal response ought to like this exactly:
Another approach to know if the OpenSSH server is installed correctly and will accept connections is to rerun the ssh localhost command in your terminal prompt. The response will look similar to this screen when you run the command for the first time:
Now, enter yes or y to continue.
Well done! Your server is now prepared to accept SSH remote connection requests coming from an SSH client on another computer.
How can I connect a Linux computer to a remote server using SSH?

The following procedures can be used to establish a secure SSH remote connection to your servers once you have installed OpenSSH on every device you require:
1.Run the following command if the username on your local device and the server you plan to connect to match:
ssh your_username@host_ip_address
You can use the following command if the username on your local device and the server you plan to connect to match:
ssh host_ip_address
And press Enter
2.Press Enter after entering your password. Keep in mind that typing will not result in any feedback appearing on the screen. Make sure your password is kept safely and not in a text file if you paste it.
3.You will be prompted to continue connecting after your initial connection to a server. Simply enter “yes” after you type it. Only this time would this message show since your local computer does not recognise the remote server.
4.You have now connected to the remote server and added the ECDSA fingerprint key.
It is better to utilise the private IP address rather than the public IP address if the device you are trying to remotely link to is on the same network. If not, all you’d need to use is the public IP address. Now, you may use your terminal to manage and operate a remote device. Check that the IP address of the remote device, your username, and your password are all accurate if you’re having problems connecting to a remote server. Moreover, confirm that a firewall is not blocking or improperly forwarding the port the SSH daemon is listening to.
Additional developments in remote control SSH
We strongly advise taking a few further actions to strengthen the remote control SSH and its security once you have established an SSH remote connection to your server. Because using default values for ssh remote connection setup makes your system more vulnerable to hacking and invasions, making SSH access in general unsafe and making your system a target of automated attacks.
The sshd configuration file can be modified to include the following tips for enhancing SSH security:
- Make changes to the SSH daemon’s default TCP port and Change 22 to a significantly larger number, say 245976. Be careful not to use port numbers that are simple to guess, such 222, 2222, or 22222.
- For password-free SSH login authentication, use SSH key pairs. They provide you a quicker and more convenient method and make it safer to log in without requiring a password.
- On your server, disable password-based logins. Because Disabling this will prevent anyone from using your password to log onto your servers if it is cracked. It is vital to confirm that key pair authentication functions properly prior to doing so.
- Use the su – command to disable root access to your server and use a regular account (to switch to a root user).
Our understanding of SSH remote connections and remote SSH access has improved. In this post, PuTTy was mentioned several times; if you are unfamiliar with PuTTy, you probably have some queries about it. As a result, in addition to providing SSH remote connection instructions, we will also describe PuTTy and demonstrate how to use it to connect to a Linux server.
What Is PuTTY?
Popular Windows terminal emulator PuTTY is available for other operating systems as well. PuTTy provides a text user interface for remote computers running any of its supported protocols, including SSH and Telnet, and is free and open-source, making it popular with Linux users as well.
NOTE- PuTTY is free to download software and offers a simple way to access the Unix shell environment from your windows system. Unlike Unix, Windows does not have a pre-installed SSH server or client. That is why the network file transfer program supports a variety of protocols, including Telnet clients.
How to Use PuTTY to Connect to a Linux Server?

After installing PuTTY, follow these instructions to connect to a Linux server using it:
STEP1-Prepare PuTTY
When you start PuTTY, the primary session configuration screen will appear. Start by entering the server’s Host Name (or IP address) to establish a connection.
As 22 is the most used port for SSH on servers, the port will be set to 22 by default, which creates a vulnerability because hackers will know which port to attack by default. Use these instructions to modify the SSH port, and then modify the number in PuTTY. Ensure that SSH is selected as the connection type.
Let’s say you don’t save your settings for future usage and don’t connect to your server using a private key. In such instance, click Open to enable an SSH connection to your server right away that authenticates with your password for the account.
If this is your first time connecting to your server, PuTTY will display a Security Warning to inform you that it lacks a key in the server’s registry. For your initial connection, it’s typical.

You will be prompted for your password if the connection is successful. Once you’ve done that, your server’s shell will now be accessible to you.
STEP2- Save the PuTTY Configuration for Next Times
To spare you from having to input everything every time, PuTTY lets you preserve the configuration you use to connect to a server. Make sure you are on the primary session setting screen mentioned above once you have completed all the required fields and are prepared to connect.
You can view your server’s hostname and port number. In the text field next to Saved Sessions, type the name of the SSH session configuration you want to store, then click Save.
How do I configure Linux for SSH public key authentication?
SSH keys can also be specified to use in PuTTY. SSH keys are a safer and occasionally more practical form of authentication. They can be created using PuTTY itself. Here is our approach on creating SSH keys on Windows with PuTTY. It can be used to swiftly strengthen your SSH security.
Setting up public-key authentication over SSH on a Linux (or macOS) computer requires the following actions:
Step 1: Generate a key pair
In order to create a key pair using the RSA algorithm, first log in to the computer you’ll use to access the remote host. Then, use the command line SSH to create the key pair. Enter the following command into the command line to produce RSA keys.
ssh-keygen -t rsa
Step2:provide the filename and password
The key pair must be saved in a file, and your private key must be password-protected. Click Enter or Return without specifying a filename if you want to keep using the key pair’s default filename and location. As an alternative, you can put a filename at the prompt like My ssh key and hit Enter or Return. A lot of remote hosts provide the option to accept private keys with the default filename and directory, so take note of this. As a result, you must specifically execute this on the SSH command line or in a /.ssh/config file for the SSH client.
A password with at least five characters must be entered, and you must then press Enter or Return. Your private key will be generated without password protection if you click Enter without first entering a password.
Step 3: Copy public key
To copy the public key file to your account on the remote system, use SFTP or SCP.
Step 4:Type in your login information.
Your account password will now be requested from you. Your public key will be copied to your home directory and kept on the remote system with the exact same filename.
Step 5: Login to the remote system
Log in to the remote system with your account username and password
Step 6: Create the required document on your account.
If the /.ssh/authorized keys file for your account on the remote system does not already exist, create it by entering the commands below:
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
Step 7: Add the information in the public key file to the authorized-keys file.
Use the command below to add a new line to your /.ssh/authorized keys file on the remote machine with the contents of your public key file, such as /id rsa.pub:
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
If your public key was properly added using the command listed below, you might wish to examine the data in /.ssh/authorized keys:
more ~/.ssh/authorized_keys
Step 8: Remove the public key file
Using the following command line syntax, you may now securely delete the public key file from your account on the remote system:
rm ~/id_rsa.pub
Alternatively, you may use the following command to transfer your public key to your.ssh directory if you prefer to keep a copy of it on the remote system:
mv ~/id_rsa.pub ~/.ssh/
Step 9: Add other systems with your public key (Optional)
Repeating these procedures at this point will add your public key to any further remote systems you choose to connect to from the computer using your private key and SSH public key authentication.
Step 10: SSH to the remote system using your account
Now that you have your private key on a distant system, you should be able to take advantage of SSH remote connections using that account. If you need to enter a password or passphrase to access your private key, the remote system will prompt you (like the picture below). Be careful not to send your private key passphrase or password to the remote system.
The remote system will bring you to the command line in your home directory without requesting a password or passphrase if your private key is not password-protected, and you will see output that looks like this:
Connect by selecting the Open tab and providing the password.
You can control a system from a distance using a variety of remote desktop applications in addition to SSH remote connections. Let’s talk about these instruments in brief.
Essential remote desktop protocols
The two remote desktop protocols, VNC and RDP, have comparable objectives but use different approaches.
Describe VNC.
Virtual network computing, or VNC, is occasionally mistaken with VPN, or virtual private network. In the peer-to-peer networking setting, which enables remote access to a computer, they both carry out the same functions. They aren’t quite the same, though.
VNC provides full device access via desktop sharing programmes that let you take complete remote control of your computer. Productivity is enhanced for all parties involved, including IT personnel, businesses, and individual users, through remote desktop capabilities.
In contrast, a VPN provides remote access to the network rather than the machine itself, so you can only access shared data and resources, like a shared printer at work.
VNC over SSH tunnel
The Virtual Network Computing (VNC) protocol cannot be used to establish a secure connection to a remote desktop. After the initial sign-in, some VNC clients do not protect your connection. To get around the issue, you can tunnel a VNC connection over a Safe Shell (SSH) tunnel. When the standard VNC port (port 5901) is blocked, the SSH tunnel offers a secure VNC connection that enables you to use VNC connections.
For further security, some corporate networks will restrict common ports like port 5901, therefore using VNC via SSH will allow you to get around this problem.
Describe RDP.
Microsoft developed the Remote Desktop Protocol (RDP), a network communication standard that enables users to connect remotely to other devices. T.120 protocols, or “regular protocols,” are an extension of the ITU’s Remote Desktop Protocol (International Telecommunications Union).
SSH Remote Connection, a last consideration
The client and the equivalent server-side element are required as two components to establish an SSH remote connection and utilise it to connect a server under Linux. This how-to article described how to exploit SSH’s advantages and gain remote access to it. To help you take full advantage of Linux’s amazing attributes, we are also pleased to offer a variety of Linux VPS plans. At cloudzy, we strive to offer you the best Linux VPS solutions possible so that the service you choose has good security and performance and provides you with an unparalleled hosting experience.
FAQ
Describe SSH.
The SSH protocol is used to connect securely to remote servers. This protocol is used by the ssh command to transmit encrypted data between the client and the host.
How do I configure SSH keys?
- Produce SSH Keys
- Name your SSH keys.
- Type a password in (optional)
- Move the remote system’s public key across to it.
- Examine your connection.
Describe SSH key pair.
A public key and a private key are the two keys that make up each SSH key pair. Data can be encrypted by anybody who has a copy of the public key, but only the owner of the associated private key can decrypt the data.
Read Our Next Articles What are differents between SSH and Telnet in 2023?
