Skip to content
nvkelso edited this page Mar 4, 2013 · 14 revisions

There's a invisible directory in your home directory for storing SSH keys. Let's go there and list the contents.

cd ~/.ssh

ls

authorized_keys known_hosts

Looks like we don't have one defined yet. Let's make one using our email address as the key.

ssh-keygen -t rsa -C "name@domain.com"

Generating public/private rsa key pair.

Enter file in which to save the key (/home/user_name/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/user_name/.ssh/id_rsa.

Your public key has been saved in /home/user_name/.ssh/id_rsa.pub.

The key fingerprint is: gibersih name@domain.com

The key's randomart image is: +--[ RSA 2048]----+ | giberish | +-----------------+

ls

authorized_keys id_rsa id_rsa.pub known_hosts

pico id_rsa.pub

SSH Tunnels

ssh -gvN -L 5432:localhost:5432 brillo.stamen

A bunch of stuff streams by...

debug1: Connecting to brillo.stamen [192.168.1.5] port 22.

debug1: Next authentication method: password

Now enter the account password:

nate@brillo.stamen's password:

debug1: Authentication succeeded (password).

More stuff streams by...

If the connection keeps being lost:

As an option on starting the connection, or modify your general config file.

in .ssh/config

Add:

ServerAliveInterval 60

##Agent forwarding

Setup agent forwarding (either by using ssh -A or adding ForwardAgent yes to $HOME/.ssh/config) and it will transparently use the keys set up on your local machine.

Clone this wiki locally