Connecting to a Linux server via SSH
Why?
SSH (Secure Shell) is a cryptographic protocol that allows you to securely connect to and control remote servers.
Instructions
Connecting from Windows
Using CMD
As of Windows 10, version 1809 (October 2018), OpenSSH is pre-installed on the system, allowing you to perform SSH connections directly from the command line.
First, ensure that OpenSSH is actually installed on the computer. To do so, open the "Command Prompt" and run the following command:
ssh -V
If OpenSSH is installed, the output will include information about the current version of the program:
To connect to a remote server via SSH, run the following command:
ssh user@ip -p<port>
where “user” is the user name on the remote server system,
ip - the IP address of the remote server,
-p<port> - the port on which the connection is made (default is "22").
For example, the command to connect to the server with the address 10.75.5.20 for the user "admin" on port 2022 will look like this:
ssh admin@10.75.5.20 -p2022
If the standard port 22 is used on the remote server for the connection, the "-p" key specifying the port can be omitted from the command.
When connecting to the server for the first time, you will be asked to confirm the connection: if you agree to connect, enter "yes" and confirm. If the connection is successful, you will be prompted to enter your user password.
Using an SSH client
If your system does not have OpenSSH, you can install a third-party SSH client and connect using it.
One of the most popular SSH clients for Windows is PuTTY.
Download it, run the installer, and go through the installation steps:
To make a connection via PuTTY, select "SSH" as the connection type in the "Connection type" field, enter the IP address of the remote server in the "Host Name" field and specify the port for the SSH protocol (default is "22") in the "Port" field, and then click the "Open" button.
Next, the program will open a terminal window similar to a command line, in which you will need to enter your login (user name in the remote system) and password.
When connecting to the server for the first time, PuTTY will also ask you to confirm the connection – click the "Accept" button.
Connecting from Linux
Connecting to a server via SSH in Linux is done via the "Terminal", which is pre-installed and available in the shortcut section or in the list of applications.
In Ubuntu, the terminal looks like this:
Run the following command to connect to the server:
ssh user@ip -p<port>
where “user” is the user name in the remote server system,
ip - IP address of the remote server,
-p<port> - the port on which the connection is made (default is "22").
For example, the command to connect to the server with the address 10.75.5.20 under the user "admin" on port 2022 would look like this:
ssh admin@10.75.5.20 -p2022
If the standard port 22 is used on the remote server for connection, the "-p" key specifying the port can be omitted from the command.
When connecting to the server for the first time, you will be asked to confirm the connection: if you agree to connect, enter "yes" and confirm. If the connection is successful, you will be prompted to enter your user password.
Connecting to a Linux server via SSH is an easy and secure way to manage a remote server.
Don't neglect security – use complicated passwords and don't share them with third parties!