SysAdmin | sys·ad·min | noun - A system administrator. The duties of a system administrator are wide-ranging, and vary widely from one organization to another. Sysadmins are usually charged with installing, supporting, and maintaining servers or other computer systems, and planning for and responding to service outages and other problems.

SSH keys

on Nov 3, 2011 | Notes-to-self | 365 comments

OK, simple stuff, but I keep finding myself looking this up every 2 months or so - maybe it'll stick if I blog it...

On the client computer

1. Generate the private and public keys using ssh-keygen:

user@client:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Created directory '/home/user/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
28:6f:3f:77:8d:db:d1:51:93:e8:b1:12:45:da:a4:f4 user@client
The key's randomart image is:

(some image)

2. Copy the PUBLIC key to the server that you wish to eventually SSH to without a password:

user@client:~$ scp .ssh/id_rsa.pub user@server:

On the server

3. Append the contents of the public key you just copied here into the .ssh/authorized_keys:

user@server:~$ cat .ssh/id_rsa.pub >> .ssh/authorized_keys

(Create the .ssh directory if it doesn't exist)

4. Important: make sure the .ssh directory and all contents are locked down:

user@server:~$ chmod 600 .ssh/*

...and that's that - you should now be able to log in without a password - use the following from the client side to troubleshoot:

user@client:~$ ssh -vvv user@server


Comments

Comments:


Leave a Comment

Title of Comment:
Name:
Email Address:
Notify me of new comments to this item:
Your Comment(s):
Security Code Below: (helps me prevent spam)
This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)