I already checked here: Trying to do ssh authentication with key files: server refused our key
and I did all these:
*new:
- generated key(s) via ssh-gen in a Linux client.
- added the public key to the server via ssh-copy
now I don't see any error message,
here's ssh -vvv:
http://pastebin.com/Cxspz5P3
Could it be that there's an order to the authentication process, but the server first tries to verify password, instead of trying out the publickey?
Original post: what I tried so far:
generated key(s) via puttygen (v.2015-12-03) in the windows client:
- 2048 bits, and tried also key-pair with 1024 bits
copied "openssh public key" in 1 line format from puttygen,
the line that looks like:
ssh-rsa xxxx... ==
pasted it to the ubuntu server to
~/.ssh/authorized_keys
one line for the 2048 bit key, additional line for the 1024 bit key
I changed the file permissions like so:
chmod 700 ~/.ssh chmod 600 authorized_keys chmod 700 ~ chown -R $USER.$USER ~/
putty session settings:
'connection' > 'data' > 'username' > myuser
'connection' > 'ssh' > 'auth' > the PPK file
tried with both 2048 bit and 1024 keys (with their respective public keys)
tried also from localhost (
ssh -i .ssh/mykey myuser@localhost
) – got the same/var/log/auth
error:Failed publickey for (myuser) from ::1 port 50087
increased log level of
/etc/sshd_config
:LogLevel VERBOSE
(is there higher value?) on the server, and restarted./var/log/auth.log
now gives:**Failed publickey for** myuser from xx.xx.xx.xx port xx: RSA xx:xx:xx...
systems:
- tried to connect from:
- from windows (putty 2015-12-3, key is PPK)
- from linux/mint 17 (via ssh, openssh key)
- server: Ubuntu 14.04.2 LTS
- keys generated by puttygen on windows (v.2015-12-03)
- also tried with "kitty" (a putty fork)
- ssh with password - works. always.
tail -f /var/log/auth.log
isn't showing anything for failed logins, only for successful and for logouts.
Can it be cured?
is there another way to diagnose the problem?
Q&A:
Q. What is a "data" connection? Why didn't you use "ssh" in both cases?
A. it's just the section's name in putty config.
Q. cat /etc/ssh/sshd_config|grep -i author
A. AuthorizedKeysFile ~/.ssh/authorized_keys
Q. ls -lZ .ssh (on the server)
drwx------ 2 myuser myuser ? 4096 Dec 5 12:28 . <---- the .ssh dir
-rw-r--r-- 1 myuser myuser ? 666 Dec 5 12:29 known_hosts
-rw------- 1 myuser myuser ? 1671 Dec 3 12:07 mykey.ssh
-rw------- 1 myuser myuser ? 608 Dec 3 11:47 authorized_keys
ssh localhost
from the Ubuntu? Where did the rsa key come from? How was it generated? Did you add it to the host or client machine? What machine was each command you show run on? What do theputty > connection
lines mean? Are those options in the putty GUI? What is a "data" connection? Why didn't you use "ssh" in both cases? Please edit your question and clarify.ssh-rsa
and the last line endinguser@computer
? Could you clarify what you mean by "copied "openssh public key" in 1 line format from puttygen": did you copy only the line beginning withssh-rsa
, or did you copy all lines of ASCII, removing the line breaks so that it fit onto one line?ssh -v [OPTIONS...] user@host
– add morev
's to increase verbosity to a suitable level) and include the output in your question. My way to debug issues from the server side is to run the OpenSSH server in debug mode, i. e. without detaching from the terminal:sudo sshd -d
(add mored
's for more verbosity). Of course you need to stop the SSH service first (sudo service ssh stop
). Maybe you can provide an excerpt of that output too.