quarta-feira, 8 de julho de 2009

Guides: Providing your SSH Key - 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
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: