How to SSH on Linux
Will explain what SSH is and further elaborate on some ways you can use SSH on Linux. Learn how to SSH via the Terminal, using PUTTY, and learn how to make it easier with XPipe.


SSH is a Secure Shell Protocol that enables secure communication between two devices. This tool allows you to access other devices from either within your network or over the internet. We will delve into several ways you can utilize this tool and learn some ways to make the process easier.
Required Applications
Terminal
Check that SSH is installed:
ssh -V
Output should be similar to this:
[unluckytech@UnluckyZ170 ~]$ ssh -V
OpenSSH_9.7p1, OpenSSL 3.2.1 30 Jan 2024
If you instead see this:
bash: ssh: command not found
Then follow the instructions below to install.
Install SSH
Update the system and install
Debian/Ubuntu/Mint
sudo apt update && sudo apt upgrade -y && sudo apt install -y openssh-client
Fedora
sudo dnf update && sudo dnf install -y openssh-clients
Arch/Manjaro/Endeavor
sudo pacman -Syu && sudo pacman -S --noconfirm openssh
openSUSE
sudo zypper refresh && sudo zypper install -y openssh-clients
Connect with SSH
Connecting to a device:
ssh - application being used
user - the user you are signing in with
192.168.1.36 - the ip of the device you are connecting to.
Will be asked if you would like to continue connecting. Type "yes"
Enter the required password and you will now have access to the remote device.
PuTTY
This application takes everything you can do with ssh and place it into a GUI. This way you can navigate through the options instead of needing to know the commands.
Installation
Debian/Ubuntu/Mint
sudo apt install -y putty
Fedora
sudo dnf install -y putty
Arch/Manjaro/Endeavor
sudo pacman -S --noconfirm putty
openSUSE
sudo zypper install -y putty
Usage
XPipe
Provides a variety of features for more then just ssh. For this case we will use it to save our login credentials and make it easier to access our devices.
Installation
A bash script that will detect your system and automate the installation.
bash <(curl -sL https://github.com/xpipe-io/xpipe/raw/master/get-xpipe.sh)
Create SSH Sessions
SSH Key Pairs
An alternative to authenticating with a password is by using SSH key pairs. This adds an additional layer of security and prevents anyone that doesn't have an authorized key from even attempting to log in.
Generate SSH Key Pairs
Check if you have any keys saved:
ls -l ~/.ssh
Generate Keys
ssh-keygen -t rsa -b 4096
NOTE: rsa is the type of algorithm being used and is available in every version of SSH. It is recommended to use a different algorithm due to the potential risks of that may come about in the future. Refer HERE for more info and alternatives.
[unluckyVM@test-VM ~]$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/unluckytech/.ssh/id_rsa):
Enter Passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/unluckyvm/.ssh/test
Your public key has been saved in /home/unluckyvm/.ssh/test.pub
The key fingerprint is:
SHA256:Vz5u0Zl4YZhoLrChky9DcSNzm6l0YcmTU/VVbHFefxk unluckyVM@test-VM
The key's randomart image is:
+---[RSA 4096]----+
| ... .E=|
| . + o + .O|
| + # o = oo+|
| X % o o + +.|
| * * S o = = |
| o = o . + |
| + . o |
| o . |
| |
+----[SHA256]-----+
[unluckyVM@test-VM ~]$
id_rsa - By default the key will save as "id_rsa" though if you already have one saved as such then change the name.
Passphrase - For this example leave empty but you can add a password if you wish to authenticate with such.
List keys
ls -l ~/.ssh
output:
[unluckyVM@test-VM ~]$ ls -l ~/.ssh
total 2
-rw-r--r-- 1 unluckytech users 3243 Apr 8 20:03 id_rsa
-rw-r--r-- 1 unluckytech users 750 Apr 8 20:03 id_rsa.pub
id_rsa - PRIVATE KEY
id_rsa.pub - PUBLIC KEY
Import Keys to Remote Server
ssh-copy-id [email protected]
It will ask for the "user" password and once entered your keys will be imported.
ssh into remote device:
Now if you did not set a passphrase with your keys you should log in without needing a password.
Last updated