I'm using ssh-agent for caching private keys; it's working well before connecting remote PC its not asking for a PASSPHRASE but its asking remote user password. Ex:

host$ sudo ssh-agent bash 
      sudo ssh localhost2.localdomain

after that its not asking passphrase its asking only remote user password.

  • Welcome to U&L! I updated the text your question slighty, but I also removed all 4 or 5 OS tags that you added, then added the more appropriate ssh-agent tag. That will help you find the people who can best help you.
    – Jeff Schaller
    Sep 13, 2015 at 20:36

1 Answer 1


With that sudo, you are switching user to root. I suspect that was not intended, as ssh will then go looking for keys in /root/.ssh/ and, finding no applicable key there, will just ask for remote user password.

I usually run exec ssh-agent bash or similar – remaining then with my own user.

And then I run ssh-add, to load (most of) my keys into the agent, before running ssh – again usually without sudo.

If I'm wrong, and the sudo was intentional, can you tell us what you are trying to achieve thereby?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .