Since yesterday, each time I try to connect to an ssh server, I got asked for my password. What should I do to make SSH not ask for my password each time.

  • Blind guess by me: check that your key is loaded with ssh-add -l.
    – jw013
    Jan 24, 2012 at 17:41
  • I assume you are using ssh keys? If you don't use a keymanager and have a non-empty passphrase, this is normal. Either use a keymanager or create an empty passphrase for your key. I guess the former is recommended.
    – user13742
    Jan 24, 2012 at 17:46
  • if it's "since yesterday", maybe it's just that you have updated your system, and now ssh-agent does not work anymore.
    – Coren
    Jan 24, 2012 at 17:52

2 Answers 2


Put your public key in hostmachine:~/.ssh/authorized_keys and make sure it has the appropriate permissions (use chmod 600). See the man page, section AUTHENTICATION, for more details. Note that sshd maybe configured to disallow this method of login although I cannot fathom why.

  • Thank, that worked. However could you explain me why do I have to put it in authorized_keys and why it was working without it before.
    – Ben D
    Jan 24, 2012 at 18:06
  • 1
    The man page has the information in the AUTHENTICATION section. As to why it was working before hand, I cannot be sure without having root access to your machines and doing some forensics work. Jan 24, 2012 at 19:50
  • 2
    You can also use ssh-copy-id in order to get your public key automatically copied to destination host, if you don't want/need to copy it manually.
    – Coren
    Jan 25, 2012 at 8:27

Check directory permissions, and file permissions.

$HOME can't be writeable by group or other.

$HOME/.ssh needs to have 700 permissions, not readable, writeable or executable by group and other.

$HOME/.ssh/authorized_keys to be not writeable or executable by anyone.

If you find that permissions aren't strict enough, try to figure out what caused the problem. Last time this happened to me, I had compiled PHP from scratch. Executing make install as root (Slackware) changed the permissions and ownership of / or /home as I recall, and kept ssh from working with authorized_keys and id_rsa.pub files that had been in place and working for ages. You want to determine what caused the problem, as changed directory ownership and/or permission can happen because of a rootkit install or something like that.

  • This fixed it for me.. After fixing my permissions, I added it using 'ssh-add'.. after closing that terminal and re-opening it and doing 'ssh-add -l' (lower L) I could see my identity, which worked.. I could SSH to all my boxes without having to type my private key pass 300+ times a day!! Thank you! Dec 23, 2016 at 11:11

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.