Question

Fail to ssh into droplet with floating ip

Posted December 17, 2019 873 views
Ubuntu 18.04

Hi guys,

Currently I’m facing a problem that is I cannot ssh into a server with floating ip using sudoer user.

I can:

ssh root@$DROPLET_IP

But when I try to

ssh user_abc@$DROPLET_IP #out: Permission denied (publickey)

I had check user and user folder (as root).

su $sudoer_user
groups wheel  # output: user_abc wheel
cat /home/user_abc/.ssh/authorized_keys # output exactly the same with root user

Can anyone help me?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @SaboteurKid,

Check if user has bee allowed
Please make sure your user does have SSH enabled. If you haven’t try the following

echo "AllowUsers NewUser" >> /etc/ssh/sshd_config

and then

service sshd restart

The above should help out with the newuser not being allowed.

Check your SSH Config
The next suggestion is a long shot but please check in your /etc/ssh/sshd_config you have the following line

PubKeyAuthentication Yes

This will allow you to connect with a public key to your droplet.

Local SSH key used
Another possible issue would be your local terminal using the wrong SSH keys. Try to SSH like so

ssh -i ~/.ssh/private_key newuser@DropletIp

Where ~/.ssh/private_key would be the path to your local SSH keys you want to use.

DigitalOcean article

Lastly, please check this article - https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/to-existing-droplet/ and make sure you have followed it to add the SSH key for your user. Of course, you’ll need to change of your .ssh folder to your root user’s directory.

Regards,
KDSys

  • I found the problem.
    When I try to apply my ansible playbook - which create wheel group and add sudoer, its created twice on host has floating ip (I accidentally list both droplet ip and float ip). Remove float ip from my inventory and everything work find.
    Thank you.

Submit an Answer