Bypass SSH login
Saturday, December 3, 2011 CST (Updated on: Wednesday, February 29, 2012 CST)
by: Eric Potvin
If you are using SSH a lot (either to connect from your development environment or production environment) you will be prompted to enter your password:
This can be annoying when you connect to these servers over and over. Here's a quick tip that will allow you not to enter your password every time you login and keep your connection between your computer and your server secure.
On your computer
ssh-keygen -t dsa
For each question, simply press the enter key at every prompt. This will output something like (this may vary):
Generating public/private dsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_dsa.
Your public key has been saved in /home/user/.ssh/id_dsa.pub.
The key fingerprint is:
The key's randomart image is:
+--[ DSA 1024]----+
| . . |
| + |
| + . . |
| o = S . |
| . + = + . |
|. o @ = . |
| . B oEo . |
| . . .o |
This produces two files: id_dsa.pub (public key) and id_dsa (private key)
-rw------- 1 user user 668 2011-11-29 13:26 id_dsa
-rw-r--r-- 1 user user 604 2011-11-29 13:26 id_dsa.pub
On your server
Edit the file
~/.ssh/authorized_keys. Note: the file might not be there
Copy the content from the public key (id_dsa.pub) in the
~/.ssh/authorized_keys and change the permissions:
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
Logout of your server, and login again! the password is now gone!
If by any bad luck you are getting this error:
Agent admitted failure to sign using the key.
Link to this Article
To link directly to this article from your web site, use one of the following snippets below.
Bypass SSH login | Book Of Zeus
<a href="http://www.bookofzeus.com/articles/bypass-ssh-login/" title="Bypass SSH login">Bypass SSH login | Book Of Zeus</a>