SSH, Secure Shell is a protocol used for an encrypted connection between client machine and server. Using it client machine will make a secure connection to the SSH server on a remote system. By this connection user can run commands on remove server. In this tutorial we will show you how to use OpenSSH command-line client with ssh command to make connection with remote machine.
There are many free and commercial SSH clients are available for Linux, Windows, macOS and others. The OpenSSH is the most widely using ssh client. Let’s see how to install OpenSSH client.
Install OpenSSH Client
The OpenSSH client is also known as ssh
. The OpenSSH client package also includes other SSH utilities such as scp and sftp.
Install OpenSSH Client on Linux
By default, OpenSSH client is pre-installed on most of Linux distributions. If your machine doesn’t have the ssh client installed then you can install it using package manager:
Install OpenSSH on Ubuntu and Debian
sudo apt update
sudo apt install openssh-client
Installing OpenSSH on CentOS and Fedora
sudo dnf install openssh-clients
Install OpenSSH Client on Windows 10
In Windows system, mostly PuTTy program is used to connect a remote server over the SSH. Windows 10 includes OpenSSH client and server. You can install it using PowerShell:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
It will show following output on success:
Path :
Online : True
RestartNeeded : False
Installing OpenSSH Client on macOS
By default, macOS ships with the OpenSSH client installed.
How to Use the ssh Command
You should check the following point before login to a remote machine using SSH:
- The SSH server must be running on the remote machine.
- An SSH port must be open in the remote machine firewall.
- You must know the username and the password of the remote account. The account needs to have proper privileges for remote login.
Below is the syntax of the ssh command:
ssh [OPTIONS] [USER@]:HOST
Type ssh
in your terminal or PowerShell followed by the remote host name and port. If you have not change default SSH port then not need to mention the port it will take by default port 22
:
ssh [email protected]
On first time login it will show message like below:
The authenticity of host '192.168.1.10' can't be established.
ECDSA key fingerprint is SHA256:aydt22mbSuNuB5unE++yowF7lgA/38bLSiO3qmDS.
Are you sure you want to continue connecting (yes/no)?
Output will different for each user and the fingerprint stored in ~/.ssh/known_hosts
file.
You should type yes
to go ahead and store the remote fingerprint. After that it will ask to enter your password:
Warning: Permanently added '192.168.1.10' (ECDSA) to the list of known hosts.
[email protected]'s password:
On successful authentication, you will be logged in to your remote machine.
Conclusion
You can make connection to your remote server via SSH using the ssh command.
If you have any questions, please leave a comment below.