Wednesday, May 13, 2009

Ubuntu SSH Autologin

Are you looking for Putty Ubuntu SSH Autologin ?


I've got a small network of Ubuntu computers at home and only one has a monitor. The rest I manage with SSH, FTP, and XDMCP logins.

Entering my password every time I want to get a terminal for one of the remote systems isn't very fun because my passwords are upwards of 16 characters. So I needed a way to login with SSH without needing to type a password.

On my main system, the one with the monitor, I used ssh-keygen at the terminal to generate a pair of public and private keys. By default ssh-keygen wants to create key files named id_rsa and id_rsa.pub but I decided to use home-network for my key files instead so I know what these ones are for.

I also just pressed enter for the passwords to leave them blank.

user@main-computer:~/Desktop$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): /home/user/.ssh/home-network
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/home-network.
Your public key has been saved in /home/user/.ssh/home-network.pub.
The key fingerprint is:
00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 user@main-computer
The key's randomart image is:
+--[ RSA 2048]----+
| |
+-----------------+
user@main-computer:~/Desktop$


Once that was done I opened my FTP application and navigated the local and remote file lists to the following directory.

/home/user/.ssh/


I uploaded home-network.pub to the remote system and renamed it to authorized_keys so that on the remote system I had the following.

/home/user/.ssh/authorized_keys


If that file already existed on the remote system, I would have opened both files in my text editor and copied the contents of the *.pub file into that authorized_keys file.

Once everything was saved and uploaded I fired up SSH to login to the remote system and was logged in without needing to enter my password.

No comments: