How to Use SSH to Connect to a Remote Server Linux or Windows. In this post, we introduce SSHprotocol, its working principle then shows you how to use SSH to connect to a remote server in Linux and Windows.
Firstly, SSH is a networking protocol used to control remote servers and protect confidential communication between two systems. Since it was first created, IT departments have used it to manage assets in businesses all around the globe. Well, SSH protocols are still essential to facilitate secure access to computer systems, and as cloud computing becomes more prominent, their significance is increasing.
Shall we start with How to Use SSH to Connect to a Remote Server Linux or Windows.
What is SSH?
Really, the SSH refers to Secure Shell. This cryptographic network protocol allows two computers to connect and exchange information over an insecure network like the internet. A remote server must be logged onto to exchange and receive data between computers and execute the command.
Secure communication requires a solid password for authentication and a public key to encrypt communication delivered through an unsecured network.
It is used to take over the role of unsafe file transfer protocols such as FTP and unsafe remote login protocols like Telnet, rlogin, and rsh.
On balance, SSH protocol connects remote hosts directly to the terminal, and its performance is based on SSH keys. So, here, we discuss SSH protocol and how it functions elaborately!
Server Authentication
Above all, SSH protocol is developed into Linux and Unix servers to enable a secure computer connection. An SSH client is required to set up a connection with an SSH server. Public key cryptography and connection setup is needed to certify the integrity of the SSH server.
Following the initial setup, the SSH protocol acquires robust symmetric encryption and hashing methods to ensure the confidentiality and integrity of the information transferred between the server and client.
Integrity and encryption
The server and client negotiate and select the symmetric encryption algorithm for their communication and create the encryption key used throughout the connection setup.
Then, SSH protocol uses strong encryption techniques, like AES, to protect communication between interested parties. The protocol also incorporates hashing techniques like SHA-2 to protect the confidentiality of the information transmitted.
User Authentication
Basically, SSH protocol secures client authentication by using public key authentication or traditional passwords. However, public key authentication is used frequently because of the dangers and shortcomings of using passwords.
So, SSH keys also offer system admins the option of manually forgoing the requirement for password based login, in contrast to being much more secure than passwords.
How a user authenticate with SSH keys? They use an SSH client (like OpenSSH) and the public private key pair to develop an ssh keygen command. Then, the user adds their approved key (public key) to the authorized_keys file on the server.
The OpenSSH server searches for authorized_keys when a user logs in remotely using key based authentication, and the user verifies the server using the corresponding private key.
Certainly, SSH offers data encryption to stop those wicked would be attackers from getting access to your user data and passwords. Below is a collection of the threats that SSH protects you from.
1. IP source routing
Although source routing is frequently used for benefits like changing the direction of a network signal if it initially fails, it is also exploited by users to make a system think that it is interacting with a different system.
2. DNS Spoofing
This is a kind of hacking attempt where information is added into the cache database on the server. As a result, the name server returns an inaccurate IP address to help divert the traffic to other computers. Usually, this computer belongs to the attacker, and they obtain critical information from there.
3. Data manipulation
The attacker acquires or changes information at intermediaries accompanied by the network route. This is usually carried out at routers, which function as a form of checkpoint or gateway for information as it travels to its final stop.
4. Sniffing of the transferred data
An insecure connection enables an attacker to watch data transfer and acquire various private or sensitive data for malicious purposes.
5. IP address spoofing
When a malicious person fabricates packets with a falsified source IP address, it is described as IP spoofing. Concurrently, it appears to be some other computer that the receiver trusts while concealing the identity and location of the source computer.
How to Use SSH to Connect to a Remote Server in Linux
In this section, we show you how to use SSH to connect to a remote server from a Linux machine.
Install OpenSSH Server and Client
Before starting, you need to install the OpenSSH server package on the server machine and the OpenSSH client package on the client machine from where you want to connect the remote server.
First step is to install the OpenSSH server package on the remote server using the following command.
apt install openssh-server -y
Next, install the OpenSSH client package on the client machine using the following command.
apt install openssh-client -y
Once you have both packages installed on the server and client machine then you can proceed to make an SSH connection.
Use SSH to Connect to a Remote Server with Password-based Authentication
Indeed, for password based SSH authentication, you need to provide a password of the remote server to make the SSH connection. Firstly, enable password based authentication on the remote server by editing the SSH main configuration file.
nano /etc/ssh/sshd_config
Uncomment the following line:
PasswordAuthentication yes
Save and close the file when you are done. Then, restart the SSH service to apply the changes.
systemctl restart sshd
Next, go to the client machine and use the OpenSSH client to connect to the remote server.
ssh user1@remote-server-ip
You will be asked to provide the username and password of the remote server to connect to the SSH server. After the successful authentication, you get into the SSH shell as shown below:
You can now run any command on the remote server to manage and configure the server.
Use SSH to Connect to a Remote Server with Key-based Authentication
On the other hand, for key based authentication, you need to generate a private and public key on the client machine. Then, you need to copy the public key to the remote server to make the password less SSH connection.
Now here, create an SSH key on the client machine with the following command.
ssh-keygen -t rsa
You should see the following screen.
After, copy the generated key to the remote server using the following command.
A). First, you need to download the Putty software on your system from the Putty official download page. Once the Putty is downloaded, double click on the downloaded file to launch the Putty as shown below.
B). Now, provide your remote server IP, and port and click on the Open button. You will be asked to trust the host machine as shown below.
C). Click on the Accept button. You will be asked to provide the username and password of the remote server.
D). After the successful connection, you get into the remote server shell as shown below.
Thank you for reading How to Use SSH to Connect to a Remote Server Linux or Windows. We shall conclude.
How to Use SSH to Connect to a Remote Server Linux or Windows Conclusion
In this article, we have covered the meaning of the SSHprotocol. We explored its advantages and how it worked. Then, we have gone through how to use SSH to connect to a remote server in Linux or Windows. Since the SSH protocol does not require a password, it has an edge over the rest. As a result, its technological development progresses efficiently and rapidly.
Do explore our Ubuntu/ Linux content of our blog over here.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.
00votes
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.