How To Use SSH to Connect to a Remote Server in linux?

0 Comments

9 mins Read

This post is dedicated to explaining how to use SSh to connect to a Remote Server in Linux. We also cover the method using PuTTY to connect to a remote Linux server. Accessing devices remotely became a requirement a long time ago, and we can hardly imagine how it would be if we could not control computers from remote places.

There are several ways to connect to a remote machine depending on the operating system you are using, but the two most widely used protocols are:

  1. Secure Shell (SSH) for Linux based devices
  2. Remote Desktop Protocol (RDP) for Windows devices

Both protocols use client and server applications to create remote connections. These tools allow you to access and remotely control other machines, transfer data, and do virtually everything you can do when physically sitting in front of the computer.

What Is the SSH and What Does it Stand for?

SSH (Secure Shell), also referred to as “Secure Socket Shell,” is a protocol that allows you to securely connect to a remote device or a server using a text-based interface. There are two most widely used protocols to connect to a remote machine: SSH and RDP. Creating an SSH connection needs both a client and a server component.

When a secure SSH connection is created, a shell session will begin, and you will be able to manipulate the server by typing commands within the client on your local machine. System and network administrators use this protocol as well as anyone who wants to access a device remotely in a highly secure fashion.

RDP VPS for Remote Desktop

Get yourself an efficient and reliable RDP VPS for your remote desktop, at the cheapest price out there. Running on powerful hardware and high-speed internet with a FREE WINDOWS.

Check Out RDP VPS Plans
RDP VPS for Remote Desktop

How Does SSH Work?

To build an SSH connection, you need two components:
the client and the corresponding server-side part. The SSH client is an application that you are running on a device that you are using to connect to another computer or server. The client uses the data provided by the remote host to initiate the connection. When the credential is validated, the client creates an encrypted connection.

On the server side, there is a part called the SSH daemon (SSHD) that constantly listens to a specific TCP/IP port for potential client link requests. If a client has started a connection, the SSH daemon will reply with the software and protocol versions it supports, and the two will share their identification data.

If the received credential is right, SSH will establish a new session for the appropriate environment. The default version of the SSH protocol for SSH server and SSH client communication is version 2.

What Is a Terminal?

If you’re new to Linux, you would like to get acquainted with the terminal. Think of it as the ultimate command shortcut hub that is the generic way to communicate with a Linux server.

Using the command line might seem like a challenging job, but it’s simple if you start with the basics and develop your skills from there.

A terminal emulator is a software that enables the terminal to be used in a graphical environment. As most people use a GUI (Graphical User Interface) operating system for their day-to-day needs, the use of a terminal emulator is a must for most Linux server users.

Linux VPS Hosting

Get yourself an economy or premium Linux VPS for hosting your website or remote desktop, at the cheapest price out there. VPS Running on Linux KVM for increased efficiency and working on powerful hardware with NVMe SSD storage for increased speed.

Check Out Linux VPS Plans
Linux VPS Hosting

What is the SSL?

SSH uses a protocol called SSL (Secure Socket Layer). The creation of public and private keys between remote servers and local computers connecting via SSH is part of the SSL security protocol. This extra layer of protection is useful, particularly in the case of brute-force password attacks.

How to Create an SSH Connection?

Because creating an SSH connection needs both a client and a server component, you need to make sure that they are installed on local and remote machines.

OpenSSH is an open-source SSH tool that is commonly used for Linux distributions. OpenSSH is relatively easy to use. It needs access to the terminal on the server and the device that you are using to connect to. Please notice that Ubuntu does not have an SSH server installed by default.

How Do I Install an OpenSSH Client?

Before you continue to install the SSH client, make sure it is not already installed. A lot of Linux distributions already have an SSH client.

  1. Run the following command to install OpenSSH on your device:
sudo apt-get install openssh-client
  1. Type superuser password when required.
  2. Press Enter to finish the installation process.

Provided that you have the necessary permissions to access together with hostname or IP address, you are now able to use SSH on any computer with a server-side application on it.

How Do I Install an OpenSSH Server?

In order to accept SSH connections, the server-side part of the SSH software toolkit must be installed on the computer.

  1. Open the terminal on your server machine. You can either look for a terminal or click CTRL + ALT + T on your keyboard.
  2. Enter the following command to install your SSH server:
sudo apt-get install openssh-server ii.
  1. Type superuser password when required.
  2. Press Enter and Y to allow the installation to continue after the disk space prompt.

The appropriate support files will be installed, and then you can check whether the SSH server is running on the machine by entering this command:

sudo service ssh status

The terminal answer should look identical to this if the SSH service is running correctly:

[email protected]: -$ 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)

How can I use SSH to connect to a remote server in Linux?


Now that you have the OpenSSH client and server installed on every device you need; you can create a secure remote connection to your servers:

  1. Open the SSH terminal on your computer and launch the following command:
ssh [email protected]_ip_address

If the username on your local device matches the one on the server you are going to connect to, you can run this command:

ssh host_ip_address

And click Enter.

  1. Enter your password and press Enter. Note that when you type, you won’t get any feedback on the screen. If you paste your password, make sure it is stored securely and not in a text file.
  2. When you connect to a server for the very first time, you’ll be asked if you want to continue connecting. Just type “yes” and press Enter. This message would only appear this time because the remote server is not identified on your local computer.
  3. The ECDSA fingerprint key is now added and you are connected to the remote server.

If the device you are attempting to remotely link to is on the same network, it is safer to use the private IP address rather than the public IP address. Otherwise, you would only need to use the public IP address.

Linux VPS Hosting

Get yourself an economy or premium Linux VPS for hosting your website or remote desktop, at the cheapest price out there. VPS Running on Linux KVM for increased efficiency and working on powerful hardware with NVMe SSD storage for increased speed.

Check Out Linux VPS Plans
Linux VPS Hosting

What Is PuTTY?

PuTTY is a popular Windows terminal emulator, but not limited to the Windows operating systems. Being free and open-source, it’s also popular with Linux users. It offers a text user interface for remote computers running any of its supported protocols, including SSH and Telnet.

Download Putty

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 Do I Download and Install Putty on Ubuntu Linux?

The Linux version of PuTTY is a graphical terminal application that is not pre-installed in most Linux distributions. Although, PuTTY can be easily installed via terminal on a Linux-based device.

If you don’t have PuTTY installed, please visit the Download PuTTY page and download the Linux installer from the Package Files section of the page.

The good news for Linux users is that PuTTY is available in the Ubuntu universe repository. To install PuTTY on Linux Ubuntu, you should first make sure that the universe repository is enabled. Use this command:

sudo add-apt-repository universe

Once the universe repository is enabled, you can update Ubuntu with this command:

sudo apt update

Then install PuTTY with this command:

sudo apt install putty

When installed, PuTTY can be started by finding it on the menu. The Linux version of PuTTY looks almost the same as the Windows version. So, you’re not going to have any difficulty trying to find your way through new and changed settings.

How Do I Connect to a Linux Server Using PuTTY?

If you want to connect to a Linux server using PuTTY after installing it, you need to take these steps:

Configure PuTTY

The main session configuration screen will appear when you launch PuTTY. Begin by entering the Host Name (or IP address) of the server you’re trying to connect to.

The port will be set to 22 by default, as this is the normal port for SSH on most servers. Change the number as needed and make sure that the Connection type is set to SSH.

If you do not use a private key to connect to your server and do not want to save your configuration for later use, you can click Open to enable an SSH immediate connection to your server that authenticates it with your account password.

If this is the first time you connect to your server, PuTTY will show a Security Warning to let you know that it does not have a key in the registry for this server. It’s usual for your first connection.

Use SSH to Connect to a Remote Server

A new window will be opened and, if the connection is successful, you will be asked to enter your password. If you entered all correctly, you will now be connected to a shell on your server.

Authenticate SSH Key

PuTTY may also be configured to use SSH keys. SSH keys are safer, and sometimes more convenient, methods of authentication.

After generating an SSH key pair and uploading the public key to your server, press Auth to display the authentication options in the sidebar of the main configuration panel.

Click the Browse button at the bottom of the screen next to the Private key for authentication and pick the saved PPK SSH key file from your local device.

PuTTY authentication SSH

Click the Open tab, enter the password, and connect.

Save the PuTTY Configuration

PuTTY allows you to save the configuration that you use to connect to a server so that you don’t have to type all the information each time. After you have filled in all the necessary fields and are ready to connect, make sure you are on the main session configuration screen described above.

You can see the hostname and port number of your server. Enter the name of your saved SSH session configuration in the text box under Saved Sessions, and press Save.

What Is VNC?

When talking about VNC (virtual network computing), it’s easy to get it confused with VPN (Virtual Private Network). They perform the same in the peer-to-peer networking environment as they allow remote access to a computer.

VNC offers comprehensive device access through desktop sharing systems that allow you to take full control of your machine remotely. Remote desktop capabilities enable productivity for all interested parties: individual users, organizations, and IT staff.n

A VPN, on the other hand, offers remote access to the network rather than to the system itself. This indicates that you can only access shared data and equipment on the network, such as a shared printer in a workplace.

Also read: How To Use VNC and VNC Troubleshooting?

Tunnel VNC over SSH

If you connect to a remote desktop using the Virtual Network Computing (VNC) protocol, your connection will not be secure. Some VNC clients do not protect your connection beyond the initial sign-in point.

You can tunnel a VNC connection over a Safe Shell (SSH) tunnel to get around the problem. Not only does the SSH tunnel provide a fully safe connection for VNC, but it also allows you to use VNC connections when the usual VNC port (port 5901) is blocked.

Some corporate networks will block common ports, such as port 5901, for extra protection, so tunneling VNC over SSH will allow you to get around this issue.

What Is RDP?

RDP (Remote Desktop Protocol) is a network communication protocol created by Microsoft that allows users to remotely link to another device. This is an extension of the T.120 protocols, which are regular protocols, as part of the ITU (International Telecommunications Union).

RDP VPS for Remote Desktop

Get yourself an efficient and reliable RDP VPS for your remote desktop, at the cheapest price out there. Running on powerful hardware and high-speed internet with a FREE WINDOWS.

Check Out RDP VPS Plans
RDP VPS for Remote Desktop

Conclusion

To build an SSH connection and use SSH to connect to a remote server in Linux, you need two components: the client and the corresponding server-side part. PuTTY is a popular Windows terminal emulator that is also popular with Linux users. The Linux version of PuTTY is a graphical terminal application that is not pre-installed in most Linux distributions.

Although, PuTTY can be easily installed via terminal on a Linux-based device. If you want to connect to a Linux server using PuTTY after installing it, you need to take these steps: configure PuTTY, authenticate the SSH key, and save your PuTTY configuration.

FAQ

What Is the Difference Between RDP and SSH?

Both RDP and SSH are used to remotely access computers and servers. One may argue that SSH is natively more secure than RDP, which requires extra support like MFA VPN for proper security.
In addition, RDP needs less technical know-how than SSH, which makes it more attractive to companies with minimal technical knowledge or smaller, inexperienced IT teams. The GUI-focused RDP makes it easily available and even functional to non-technical employees.

What Is XRDP?

XRDP offers a graphical login for remote machines using RDP (Microsoft Remote Desktop Protocol). XRDP supports connections from a range of RDP clients for Windows, macOS, iOS, and Android systems. XRDP not only supports remote graphics, but also two-way clipboard transfer, audio redirection, and drive redirection.

What Is a Linux VPS?

Linux VPS is a virtual server hosted on a physical server configured for Linux operating system. It’s also a combination of shared hosting and dedicated server hosting.
It means that in most situations, you have to share your server with other users. But that doesn’t reduce the efficiency of your site, and you don’t experience any downtime problems on the hosting administration side.

2
0
A Web designer, with Experience in digital marketing , Totally fueled by passion to understand and learn different aspects of digital marketing.

Comments

Leave A Comment