MAC OS X Lion 10.7.3

1) On host, I've created an authorized_keys file inside .ssh folder, by doing:

touch authorized_keys

2) I've copy my public ssh key into host .ssh folder by doing:

scp ~/.ssh/mykey.pub userhost@host.com:/home/userhost/.ssh/mykey.pub

3) I've place it's contents inside authorized files by doing:

cat mykey.pub >> authorized_keys

4) Then I've removed the mykey.pub file:

rm mykey.pub

5) On my terminal, locally, inside my ~/.ssh folder I made:

ssh-add mykey

(notice that it is without the pub extension);

6) I've closed and opened again the terminal.

When I first connect to this host, it has being added to the known_hosts file inside ~/.ssh; I've pico known_hosts and the hash is there.

Still, every time I connect by doing: ssh userhost@sharedhost.com it requests a password !

What am I missing here ?


I've done EVEN TWO MORE THINGS here:

7) Set your key to be the default identity - if it doesn't exist, create;

touch ~/.ssh/config

and place inside the following line:

IdentityFile ~/.ssh/yourkeyname

id_rsa is normally your default key. You should switched to your key. This tells that the outgoing ssh connections should use this as a default identity.

8) Add a bash process to your ssh-agent:

ssh-agent bash

ssh-add ~/.ssh/yourkeyname

Lisinge answer helped but it's not definitive. If we restart our machine, the password gets prompted again!!!

How can we debug this? What can we do here? How can we check where is this process failing ?


If I use:

ssh -v -i <keyfile> userhostname@hostname.com

I get among other things:

OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011 Warning: Identity file yourkeyname not accessible: No such file or directory.

This message refers to what? The identify file is not accessible on the localhost, or it's not accessible on the remote host ?

Please advice


Are you sure you created the key without a password?

Because if the key was created with a password then the password has to be entered every time the key is accessed.

Try creating a new key and just pressing enter (leave the password blank) and add that to the host and connect again.

  • That helped but didn't worked. It was a permission related issue on the shared host ssh and authorized_keys file. Cheers!! – MEM Mar 27 '12 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.