I am trying to ssh to localhost, but it's asking for a password every time.

What I tried:

ssh localhost
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa 
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
  • Please edit your post to include the output of ssh -vv localhost – muru May 15 '16 at 19:46

DSA keys are not accepted in recent versions of openssh by default. You should use rsa, which works fine and is considered more secure by the openssh developers. If you really want to use dsa keys, you should add

PubkeyAcceptedKeyTypes +ssh-dss

line into your sshd_config and restart ssh service.

  • This did the trick. Thank you. The way to discover this is that logging into the server with the -vvv flag has a line debug3: receive packet: type 51 inside of the output that reveals that the authentification failed. – Pierre François Jan 23 '19 at 17:18

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.