Ubuntu: SSH Public Key - No supported authentication methods available (server sent public key)
Question: I have a 12.10 server setup in a virtual machine with its network set to
bridged (essentially will be seen as a computer connected to my switch).
I installed opensshd via apt-get and was able to connect to the server using
putty with my username and password.
I then set about trying to get it to use public/private key authentication. I
did the following:
1. Generated the keys using PuttyGen.
2. Moved the public key to /etc/ssh/myusername/authorized_keys (I am using
encrypted home directories).
3. Set up sshd_config like so:
PubkeyAuthentication yes
AuthorizedKeysFile /etc/ssh/%u/authorized_keys
StrictModes no
PasswordAuthentication no
UsePAM yes
When I connect using putty or WinSCP, I get an error saying No supported
authentication methods available (server sent public key).
If I run sshd in debug mode, I see:
PAM: initializing for "username"
PAM: setting PAM_RHOST to "192.168.1.7"
PAM: setting PAM_TTY to "ssh"
userauth-request for user username service ssh-connection method publickey
[preauth]
attempt 1 failures 0 [preauth]
test whether pkalg/pkblob are acceptable [preauth[
Checking blacklist file /usr/share/ssh/blacklist.RSA-1023
Checking blacklist file /etc/ssh/blacklist.RSA-1023
temporarily_use_uid: 1000/1000 (e=0/0)
trying public key file /etc/ssh/username/authorized_keys
fd4 clearing O_NONBLOCK
restore_uid: 0/0
Failed publickey for username from 192.168.1.7 port 14343 ssh2
Received disconnect from 192.168.1.7: 14: No supported authentication methods
available [preauth]
do_cleanup [preauth]
monitor_read_log: child log fd closed
do_cleanup
PAM: cleanup
Why is this happening and how can I fix this?
Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):
== This solution helped 10 people ==
1. Edit the /etc/ssh/sshd_config file.
2. Change PasswordAuthentication and ChallengeResponseAuthentication to yes.
3a. Restart ssh /etc/init.d/ssh restart.
OR
3b. better you use service sshd restart
== This solution helped 3 people ==
SOLVED:
1. You need to download the puttyGEN and generate a public and a private
key.
2. I've assigned a password to my private key.
3. then configure the private key in putty. Putty->SSH->Auth->Browse to your
private.
4. Ensure you have the same path for private and public key.
5. You need to configure the public key on the server. (In my case I've
talked with the server guy and asked if he could add my public key to the
server). You need the public key in the other side (server) the
connection.
== This solution helped 5 people ==
In my case the reason was that private key file (.ppk) had been removed in
Putty authentication agent i.e. Pageant. I just updated it again to Pageant
there and connection worked perfectly after that.
With thanks & praise to God! With thanks to all the many who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music & music license: https://www.bensound.com/royalty-free-music | Images & images license: https://stocksnap.io/license and others | With thanks to user waltinator (https://askubuntu.com/users/25618), user Sharad (https://askubuntu.com/users/387746), user Matt.sinner (https://askubuntu.com/users/149996), user Marko H (https://askubuntu.com/users/236958), user Hunter (https://askubuntu.com/users/441215), user F21 (https://askubuntu.com/users/30842), user Eric Carvalho (https://askubuntu.com/users/65926), user Dave (https://askubuntu.com/users/135925), user Basharat Sialvi (https://askubuntu.com/users/37006), and the Stack Exchange Network (http://askubuntu.com/questions/204400). Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.
3 Comments