Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use a notebook with Ubuntu 12.10 and try to connect a server with Ubuntu 12.04. The server has already installed openssh-server. And allow publick key and password to login. But I connect the server sometime well but after minutes it will be error. First, it will show me these messages:

   Add correct host key in /home/myname/.ssh/known_hosts to get rid of this message.

but I never reinstall system and the openssh-server. Both are never changed! The server nerver shutdown or reboot.

Second, after I remove the relative key from my known_hosts and use ssh connect the server again, it will let me type my password. then my nightmare coming... Permission denied (publickey,password)

But I typed the correct password!

PS: I used password and public key both success. But the problem will appear again after i logout then login.

share|improve this question

migrated from Nov 23 '12 at 10:18

This question came from our site for professional and enthusiast programmers.

Do you want to allow password auth? If so you can edit the /etc/ssh/sshd_config to include:

PasswordAuthentication yes

Also make sure these are set correctly for your key auth:

PubkeyAuthentication yes
AuthorizedKeysFile     %h/.ssh/authorized_keys

You can also have it ignore your known_hosts file... for debugging only please :)

IgnoreUserKnownHosts yes

Also ensure you have correct perms on your key files.. ssh is very particular about it:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/*

Lastly, if all else fails send us output of your session attempt using 'ssh -vvvv'.

share|improve this answer

You must log in to answer this question.