Unable to log in via SSH with user

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.1.15
I have access to my server : Through SSH | through the webadmin |
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : Changed SSH port, disabled password SSH auth per https://yunohost.org/en/security

Description of my issue

After the recent upgrade, I am attempting to log in via SSH with a user in the admin group, so that I can remove the legacy admin user.

When I attempt to log in, however: ssh -i <pathToKey> -p <portNumber> <username>@<host>,
I receive the following error: Permission denied (publickey).

I have tried :

  • yunohost user permission add ssh <username>
  • yunohost user ssh add-key <username> <keyUsedByLegacyAdminUser>
  • Restarting sshd
  • Restarting slapd
  • Rebooting the server

I am able to login with admin@ using the same key just fine.

You can verify on the folders…
I have create the folder /home/my_user/.ssh connected with my_user, in root do a su - my_user
but perhaps you have it yet ?
and then the file /home/my_user/.ssh/authorized_keys where I paste my public ssh key.
The permissions must be: chmod 700 /home/my_user/.ssh and chmod 600 /home/my_user/.ssh/authorized_keys
After if the user can connect ssh with my_user@domain.tld is better delete the user admin_legagy…

1 Like

This was it: I didn’t have the permissions / owner of .ssh & .ssh/authorized_keys set correctly. Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.