On an Ubuntu 16.04 system on Google GCP, I need to create a new user hello and allow other users to SSH to the system as user hello using their current SSH keys.

Here's what I did to add my SSH public key to hello's authorized_keys:

sudo useradd -m hello -s /bin/bash
sudo mkdir /home/hello/.ssh
sudo chown hello:hello -R /home/hello
sudo chmod 777 /home/hello/.ssh
sudo cat ~/.ssh/authorized_keys >> /home/hello/.ssh/authorized_keys
sudo chmod 700 /home/hello/.ssh/
sudo chmod 600 /home/hello/.ssh/authorized_keys

Problem: When I try to SSH to the server as hello user, I get the error

Disconnected: No supported authentication methods available (server sent public key)

/var/log/auth.log contains

Nov 4 17:37:05 hello sshd[27298]: error: Received disconnect from port 62346:14: No supported authentication methods available [preauth] Nov 4 17:37:05 hello sshd[27298]: Disconnected from port 62346 [preauth]

What went wrong? Thank you!

  • 1
    Who owns authorized keys , what ssh command, and what ssh server config?
    – Panther
    Nov 4, 2017 at 18:03

3 Answers 3


You need to change the owner of the file authorized_keys after it is created, since it will be owned by the user running the script.

Adding this as last line to your script should do the trick.

sudo chown hello:hello /home/hello/.ssh/authorized_keys


Maybe in server site this user "hello" is blacklisted

try this:

grep **AllowUsers** /etc/ssh/sshd_config

or this:

grep **DenyUsers** /etc/ssh/sshd_config

try with groups too AllowGroups and DenyGroups.


Check the /home directory permissions. It should be

  • drwxr-xr-x. 9 root root 113 Jun 28 22:57 home

and then your home directory detail:

  • drwxr----- 5 user group 124 May 18 17:00 User drwx------ 2 user group 29 May 18 12:05 .ssh -rw------- 1 user group 2235 Jun 28 23:09 authorized_keys

My error messages in logs

/var/log/auth.log > sshd[22565]: error: Received disconnect from X.X.X.X: 14: No supported authentication methods available [preauth]

On client side

ssh [email protected] Permission denied (publickey). ssh -vvv [email protected] ... debug2: we did not send a packet, disable method debug1: No more authentication methods to try. Permission denied (publickey).
On server side

  • service sshd stop

  • run sshd debug mode:

  • /usr/sbin/sshd -ddd

    ... debug1: trying public key file /home/USER/.ssh/authorized_keys debug1: Could not open authorized keys '/home/USER/.ssh/authorized_keys': Permission denied ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .