Bypass SSH login
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:
user@server.com's 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 log-in and keep your connection between your computer and your server secure.
On your computer
cd ~/.ssh
Then execute:
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: ad:98:43:13:c9:ea:66:8e:d0:d9:66:59:d8:3a:f7:29 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)
user@computer:~/.ssh$ ll total 40 -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
vi ~/.ssh/authorized_keys
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.
Simply, run:
ssh-add