Linux SSH Beginners Tutorial

Here we will learn about the SSH on Linux System.

Some Basics of SSH

What is SSH

SSH (Secure SHell) is a Network protocol used for communication between two networked computer. It is different from other protocols in way that it provide security while accessing other system. Hence anyone on network will see only encrypted data and not the plain data.

Use of SSH

SSH can be used for below purpose

  1. Terminal Access
  2. Remote Command Execution
  3. File Transfer (Using SFTP or SCP protocol)
  4. Tunneling
  5. TCP Ports forwarding
  6. X11 Connection

Assigned port for SSH

Port 22 has been assigned for SSH server.

Type of SSH

SSH can be divided in two parts

  1. SSH server : Program uses SSH protocol to run service on system and wait for clients connection.
  2. SSH Client :  Program uses SSH protocol to connect to remote server.

Example of SSH Server

Example of SSH Client

How it works

SSH is based on Public Key Cryptography

What is Public Key Cryptography (PKC)

There are two keys used in PKC.

  1. Public Key
  2. Private Key:

Public Keys

Used to Encrypt Data. It can be shared publicly.

Private Keys

Used to Decrypt Data. Not supposed to be shared.

How to Create Keys

To create authentication keys ssh-keygen command can be used.

Above command will create public and private rsa key pair.

What is Passphrase

When you create Private key as above. It will be stored in a file and any one having access to given file can misuse private key. Hence to secure private key from unauthorized access, Pass-phrase should(Not compulsory) be provided while creating private key.


Storing Location of Keys

Public key will be stored in ~/.ssh/authorized_keys OR ~/.ssh/ Private Key will be stored in ~/.ssh/id_rsa.

Getting Started with SSH

Here we will learn about the basic commands related to SSH. (I am using Ubuntu so some part might be different for other systems.)

Note: It is most likely that Linux system you are using have SSH already installed. If not you can use below command to install it.

 Start / Stop SSH Server (SSH process)/ Client (SSHD Process)

Now you have installed SSH, next step would be to start or stop these services(SSH/SSHD). You can use below command to start/ command these services.

Check status of SSH server


To Start


To Stop


To Restart


Note*: You can not restart the server if it is not in started mode. 



Leave A Comment

Your email address will not be published. Required fields are marked *