Ssh-agent not working properly

debiansshssh-agent

I'm currently trying to get ssh-agent to work.
No matter what I'm doing, I just can't get the around the password prompt.

For testing I even tried connecting to localhost:

  • ssh-keygen to generate the id_rsa
  • ssh-add id_rsa in the .ssh folder
  • ssh-add -l shows the correct fingerprint
  • ssh user@localhost still asks me for a password
  • eval $(ssh-agent -s) shows the process running

Is there something else I need to configure before using the ssh-agent?
I tried it with several machines and users, as well as RSA and DSA keys.

I'm using Debian 7 btw.

I would appreciate if someone could give me a hint, where my problem might be.

Best Answer

You generated a ssh key. That alone doesn't enable public key authentication, you also need to add the public key to the file ~/.ssh/authorized_keys on the remote machine, to the account you want to log to. The easy way to do that is with ssh-copy-id:

ssh-copy-id hostname

or

ssh-copy-id username@hostname

if the username on the remote host is different from the one on the current machine. This will ask for your password on the remote machine.

Related Question