SSH - Secure Shell - What is it ?

April 12, 2012
This guide explains how to use SSH (a secure shell) protocol to connect to remote computers.

What is SSH ?

SSH is an acronym for Secure Shell. SSH is also commonly used to denote a network protocol that allows data to be exchanged using a secure channel between two networked devices. SSH uses public-key cryptography to authenticate the remote computer and allow it to authenticate the user, if necessary.

All the communication through SSH between you and the remote machine will be securely encrypted thus making it immune to eavesdropping.

To use SSH to communicate between two remote computers, you need two pieces of software. They are -

  1. SSH client program, and
  2. SSH server

This guide covers only the SSH client part. Please refer the appropriate Internet resources to learn how to configure an SSH server.

There are lots of free, and open source SSH clients available for almost all platforms.

For example, a very useful free software that works as an SSH client in Windows is PuTTY

PuTTY Homepage :

SSH in Linux

SSH works very well in Linux. Almost all Linux distributions have an SSH client.

OpenSSH SSH client - ssh - is the default SSH client program in Linux.

OpenSSH SSH client supports SSH protocols 1 and 2. SSH protocol 2 is used by default as it supports additional mechanisms for confidentiality (the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour) and integrity (hmac-md5, hmac-sha1, umac-64, hmac-ripemd160).

How to use SSH

In Linux, you use the ssh command to connect to a remote machine.

The basic syntax is as follows -

$ ssh username@hostname

hostname can be a FQDN or an IP address.

To connect to a remote machine, it should be running an SSH server.

SSH Examples

Login to a remote machine using SSH

What you will need - User name, host name, and password.

Username - ravi
Host name -

$ ssh
The authenticity of host ' (' can't be established.
RSA key fingerprint is 29:52:c5:30:3d:91:57:be:ba:20:cb:fd:2b:38:0b:ef.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ',' (RSA) to the list of known hosts.

[email protected]'s password: 
Last login: Mon Feb  7 07:49:50 2011 from
[email protected] [~]$_

Securely copy files to a remote machine

The command you use to securely copy files from your machine to a remote machine is scp.

Action - Copy file 'test.txt' residing in the remote machine to the home folder in my local machine.

$ scp [email protected]:test.txt ~/.
r[email protected]'s password: 
test.txt  100%   12     0.0KB/s   00:00

Bonus SSH tip - How to setup SSH keys.

References for further reading

OpenSSH website
SSH man page.

Also see ...

Mosh - A replacement for SSH