How do I use secure shell (SSH) software?

Introduction

SSH provides a secure means to access a UNIX command-line shell on a remote computer. It also provides a way of transfering files and securing otherwise unsafe protocols.

The term 'SSH' may be used to name the secure connection protocol and the name of the primary program that implements the protocol.

Getting SSH software on your personal machine

  • Mac OS X comes with SSH preinstalled. Just open Terminal.app (usually locations in /Applications/Utilities/) as described below.
  • Windows users can use a free program called putty available at http://www.chiark.greenend.org.uk/~sgtatham/putty/. You may choose to download putty as a single executable  file which can be stored wherever you find it convenient, or as an installer which provides several other programs such as scp and sftp. 
  • An alternative for Windows is Cygwin, a UNIX-like environment for Windows, which includes openssh among its packages. (Basically, you first download a program called setup.exe, which makes it possible to install a wide variety of software. For SSH you need to choose at least openssh. Clicking on the View button in the setup.exe window until it displays "Full" makes it easier to find the packages you need.)
  • Linux distributions usually install SSH by default. If not, you will need to use your distribution's software management program to install SSH. You can open any terminal window such as gnome-terminal, konsole, or xterm to run SSH.

Basic Usage

The most common way of logging into a remote site from the command-line is with 'ssh username@remotehost'. An alternative is 'ssh -l username remotehost'. If your local username is the same as your remote username, you needn't specify it on the command line, e.g. 'ssh remotehost'. putty uses a graphical user interface to set the username and remotehost.

Here is an example command-line login:

me@my-laptop$ ssh myusername [at] scf-ug01 [dot] berkeley [dot] edu
The authenticity of host 'scf-ug01.berkeley.edu (128.32.135.63)' can't be established.
RSA key fingerprint is 9c:a6:e2:8e:80:01:6f:13:58:3f:be:c1:79:b5:1f:a2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'scf-ug01.berkeley.edu,128.32.135.63' (RSA) to the list of known hosts.
scf-ug01 [at] scf-ug01 [dot] berkeley [dot] edu's password: 
You have mail.
...
scf-ug01:~$ 

Whenever SSH connects to another computer, it receives a digital fingerprint of that computer. If you are connecting to a computer for the first time, it asks whether you want to continue, and then saves the fingerprint for the next time you want to connect. If you have connected to that computer before, it checks to make sure that the fingerprint is the same as it was the first time you connected to that machine. If the fingerprints are different, it will warn you that someone might have installed nefarious ssh software on the remote host. This is useful because bad people to break into computer seldom know the passphrase that the remote administrator used to generate the fingerprint with.