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 -
- SSH client program, and
- 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 : http://www.chiark.greenend.org.uk/~sgtatham/putty/.
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 - xyz.com
$ ssh ravi@xyz.com The authenticity of host 'xyz.com (98.147.xxx.xx)' 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 'xyz.com,98.147.xxx.xx' (RSA) to the list of known hosts. ravi@xyz.com's password: Last login: Mon Feb 7 07:49:50 2011 from 98.92.xx.xxx ravi@xyz.com [~]$_
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 xyz.com to the home folder in my local machine.
$ scp ravi@xyz.com:test.txt ~/. ravi@xyz.com'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
OpenSSH FAQ
SSH man page.
Also see ...
Mosh - A replacement for SSH