Home arrow Latest Tutorials arrow SSH Public key based authentication
SSH Public key based authentication PDF  
Digg Reddit Stumble Upon Facebook Twitter Google Technorati Bookmark
Saturday, 15 December 2007

Here is a mini Howto about configuring your SSH service to work with Public Keys Based Authentication.

So, you have a Linux/UNIX Workstation and you want to connect via SSH to a Linux/UNIX using Public Keys Based Authentication.

Step 1. Login to your Linux/Unix Workstation to create your Private/Public Keys.
-------------------------------------------------------------------------------------------------


# ssh-keygen -t rsa

You will be prompted to enter file in which to save the key (/home/user/.ssh/id_rsa).
Then you will be prompted to enter a passphrase.You can also choose not to add a passphrase, in which case you press enter.

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


Step 2. Copy your public key (id_rsa.pub) to your Linux/UNIX Server using scp
----------------------------------------------------------------------------------------------


# scp /home/user/.ssh/id_rsa.pub  \n This email address is being protected from spam bots, you need Javascript enabled to view it This email address is being protected from spam bots, you need Javascript enabled to view it :/.ssh/authorized_keys2


If you need to connect to your server from multiple Linux/UNIX stations you must generate Private/Public Keys on each workstations then append content of id_rsa.pub files from every workstation to your authorized_keys2 file from your server.

Tips
------

a) Change passphrase on your workstation:

# ssh-keygen -p


b) Manage your passphrase with ssh-agent, in order not to input passphrase at every ssh auth.

On your workstation type:
# ssh-agent $BASH
# ssh-add

Then type your passphrase. From now on, you will not be prompted to enter a password.

c) List keys
# ssh-add -l

d) Delete a key
# ssh-add -d key

(-D to delete all keys)

Notes
-------
Your sshd config file should contain:

RSAAuthentication yes
PubkeyAuthentication yes


In order to properly work, rights to authorized_keys2 shoud be 600
 
< Prev   Next >

Misc

Linux Tips

Polls

What is your favorite Linux Distribution ? (we just added Mint and reset the pool data)