UsingSSH

From SourceWiki
Jump to navigation Jump to search

Using SSH to connect to machines and to move data

Introduction

Using Key-Pairs

Creating the Keys

First, let's create a key-pair. Start by typing:

ssh-keygen

You will see a message like:

Generating public/private rsa key pair.
Enter file in which to save the key (/gsb6/ggdagw/.ssh/id_rsa):

The default filename suggested is fine, so accept it by hitting return.

Next you are prompted for a passphrase:

Enter passphrase (empty for no passphrase):

Think of a strong, yet memorable one and enter it. (One tip is to think of a phrase, saying, song lyric etc. For example "One small step for man, one giant leap for mankind." Then take the first letters from each word, perhaps substituting digits for letters, to create the passphrase, "Oss4mogl4m.") You will be prompted for your passphrase twice:

Enter same passphrase again: 

When the key-pair creation is completed, you will get some lines of text as confirmation, such as:

Your identification has been saved in /gsb6/ggdagw/.ssh/id_rsa.
Your public key has been saved in /gsb6/ggdagw/.ssh/id_rsa.pub.
The key fingerprint is:
37:7a:b3:81:e2:0e:fa:5e:b2:df:84:a5:fb:f9:e6:f7 ggdagw@dylan.ggy.bris.ac.uk

Distributing Your Public Key

Now that you have your

Using ssh-agent

ssh-agent bash

Using ssh-keychain