quarta-feira, 8 de julho de 2009

Guides: Providing your SSH Key - Linux

Linux

Step 1: Check to see if you already have a public/private key pair for your user.

If you do, it will be in your ~/.ssh directory.

[~]$ cd .ssh
[~/.ssh]$ ls
config id_dsa.pub
id_dsa known_hosts
Key pairs are always named like something and something.pub. The something file is your private key and must be kept secret. The something.pub file is your public key, and this is what you’ll belong public domain.

Step 2: Generate a public/private dsa key pair if you don’t already have one.

This is done with the ssh-keygen program:

[~/.ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/tom/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/tom/.ssh/id_dsa.
Your public key has been saved in /home/tom/.ssh/id_dsa.pub.
The key fingerprint is:

Step 3: Upload your public key to Someone.

Copy your public key to the clipboard so you can easily paste it into your web browser. If you have xclip installed then:

[~/.ssh]$ cat id_dsa.pub | xclip

The xclip command copies whatever is sent to it via STDIN to the clipboard (you may have to use xclip -selection clipboard), ensuring that you won’t have any extraneous newlines or other problems. If you don’t have xclip then either install it using your OS’s package manager or print out the public key to a terminal so that you can manually copy the key data.

[~/.ssh]$ cat id_dsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA1FlHRbbxXIv/hLDTeJczlEqGNt0oFcoPEEENHThzP5ku
PDsitSSUH2MATP014G/3BzaI9pdnhf02MSEcmtmIKXrm05/dzxEmp9yOY32YHyk6/rLUGGTJuWOpGt3J
6H5LWxq9yeRUuFG/pCRH3+KxOyzasSHXfXJaC5v7wPxUdAeg9k0jwsUjnqUcYvzo5+GwCXV9dIwY3Sr/
OrL2l8SCdSWyd3PLufJXKQHlouHB0NI/+G/QjWmkB8c1PJh/VuIe36mqv82V9XXKvYNaVWwz5Sg6aY9u
p2lgDEme+AFdPPjOnkdF6OHCr7ymKg6c/B2YCbOW7QN/L4uAdVOhTNnJMQ== tom@volcano

Copy the entirety of the public key to the clipboard. It is important that there are no newlines in the key (copying from the cat output in your console should work properly. Now you can simply select the place box and paste in your public key!

Nenhum comentário: