Login to a Linux server without using passwords
Section: Linux Articles
Date: 29 April 2007
Author: Tim Butler
For those familiar with using SSH to access remote servers, you will know how frustrating it can become remembering passwords across different systems. It's especially annoying if you are accessing many servers at once or in the same day, and you have to remember passwords for each system.
Thankfully we can easily remove the need for passwords by using keys.
This guide uses Ubuntu 6.10 Linux as the testbed (which uses OpenSSH version 4.3) so your mileage may vary with other systems. If this works (or even doesn't work) for a different distribution / operating system, please feel free to leave a comment at the end of this article so that other readers know what works.
On the system you want to login with via keys, run the following command:
[demouser@client ~]$ ssh-keygen
This will generate an identification file (id_rsa) as well as prompt you for a passphrase. Please remember that if you do not set a passphrase, anybody who can read your files will be able to access server you pair the key with. For this reason, it's NOT recommended to
To activate this key with the remote server, simply run:
[demouser@client ~]$ ssh-copy-id servername
It will assume that the user of the current system you are using is the same as the remote server. If you're setting this key up for a different user on the server, simply use the standard ssh syntax like this:
[demouser@client ~]$ ssh-copy-id othersername@servername
To test that the setup works, simply login to the server
[demouser@client ~]$ ssh username@server
Assuming that you set a passphrase, you should see a GNOME dialog box asking you for your passphrase like this:
This allows you to save your passphrase into the GNOME Keyring, meaning that you'll only ever have to enter the password to your keyring when you first login to gain access. To test this simply login to your server again and this time there shouldn't be any prompts for your password!
I hope this quick guide has been some use to you, especially if you've got multiple logins to many different servers.











