UnluckyTech
HomeDiscordYoutube
  • Welcome
  • knowledge base
    • Guides
      • SSH
        • How to SSH on Windows 10/11
        • How to SSH on Linux
        • How to SSH on MacOS
      • VPS
        • DigitalOcean WebHosting
      • Local WordPress Environments
        • Get Started with WordPress on Docker
        • Integrate Github Actions with LocalWP
      • Virtual Private Servers (VPS)
        • CloudPanel & Digital Ocean
    • Documentation
    • Certification
      • COMPTIA N10-008 Network+
  • Links
    • Website
    • Youtube
    • Discord
    • Twitter
    • Donate
Powered by GitBook
On this page
  • Required Applications
  • Terminal
  • Install SSH
  • Connect with SSH
  • PuTTY
  • Installation
  • Usage
  • XPipe
  • Installation
  • Create SSH Sessions
  • SSH Key Pairs
  • Generate SSH Key Pairs
  • Import Keys to Remote Server
  1. knowledge base
  2. Guides
  3. SSH

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.

Last updated 1 year ago

ME

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 user@192.168.1.36

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
[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 user@192.168.1.36

It will ask for the "user" password and once entered your keys will be imported.

ssh into remote device:

ssh user@192.168.1.36

Now if you did not set a passphrase with your keys you should log in without needing a password.

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 for more info and alternatives.

Terminal
PuTT
Y
XPipe
HERE
OpenSSH
ssh.com