Report this

What is the reason for this report?

ssh via Tunnel fails (publickey)

Posted on July 31, 2024

i have a strange issue, started a new droplet, everything basic with an ssh-rsa kay attached, i can log in via ssh just fine, but when i try to use a application that utilizes a ssh tunnel … Like navicat sql or a sftp client, i’m getting a pubkey or a general access denied erro. i have done this with quite alot of servers already, made sure permissions are correct, the keys are valid, sshd config is pretty much out of the box (i just disabled password auth and PAM use)

Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.
0

Accepted Answer

Hello,

I’ll recommend you to check the logs in /var/log/auth.log or /var/log/secure (depending on your Linux distro):

sudo tail -f /var/log/auth.log

Some commond errors can be:

  • Authentication refused: bad ownership or modes for directory - Incorrect permissions.
  • Failed publickey for user - Incorrect SSH key or user settings.

You can ensure that your SSH key permissions are set correctly on your local machine. Permissions for the SSH key must be restrictive:

Private Key: Should be readable only by your user.

chmod 600 ~/.ssh/id_rsa
  • Public Key: Usually has less restrictive permissions.
chmod 644 ~/.ssh/id_rsa.pub

SSH Directory: Should be accessible only by your user.

chmod 700 ~/.ssh

Check permissions on your server as well:

Authorized Keys: Should be readable only by the user.

chmod 600 ~/.ssh/authorized_keys

Regards

Heya,

Are you sure that the Apps you are using are actually getting the proper key to use?

I’ve had instances where I couldn’t connect just because the APP I was using didn’t get the proper key.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.