Ancient Programming

What I encounter in my software part of life is in danger of being commented upon here

Howto setup smooth ssh access

Posted by Jacob von Eyben on October 24th, 2008

Everytime I have a new machine or a new ssh access to setup I forgot how to configure the access so I don’t have to type the username each time (if I login with a different user).
At the same time I would like to use a private rsa key. So here goes a note to myself and other scatter brains :-)

Instead of always have to type username and password like this:

[jeyben@machine ~]$ ssh username@www.ancientprogramming.com
Password:
Last login: Fri Oct 24 16:31:03 2008 from somewhere
[username@servername ~]$

I would like to just do the following:

[jeyben@machine ~]$ ssh ancientprogramming
Last login: Fri Oct 24 16:31:03 2008 from somewhere
[username@servername ~]$

Create and use a public/private key pair

Client

$ ssh-keygen -t rsa
$ scp ~/.ssh/id_rsa.pub www.ancientprogramming.com:~

Server

$ cat ~/id_rsa.pub >> .ssh/authorized_keys

Modify .ssh/config

Host ancientprogramming
  User <username>
  Port 22
  HostName www.ancientprogramming.com
  LocalForward 3307 localhost:3306 (setup a localforward for the default mysql port)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>