Why is my SSH configuration trying to use the admin’s authorized_keys for a different user?

0
9
Asked By CuriousGadget93 On

I have an Ubuntu server with two user accounts, 'admin' and 'user'. The 'admin' user can SSH into the server without any issues, but when the 'user' tries to connect, they get a refusal during authentication. After running a debug SSH command, it shows that the server attempts to access the 'admin' user's authorized keys instead of the 'user's. All permissions for the .ssh directories and the authorized keys seem correct for both users. I made some adjustments to the sshd_config file to set the AuthorizedKeysFile to use the user's own authorized keys, but the server is still looking at the admin's keys. What could be going wrong here?

3 Answers

Answered By BinaryBeast1 On

This sounds quite peculiar! If your configuration specifies the correct file and it still checks the admin's file, try running `systemctl status sshd` to ensure the right SSH service is active, not another one like dropbear. In some systems, the configs can vary based on distro, so just confirm that everything matches the standard expectations.

Answered By TechieTribe44 On

It sounds like there might be a mix-up in your SSH configuration. If you’ve already verified that the right authorized_keys permissions (like 600 for authorized_keys) are set and the user's .ssh directory is correct, double-check your sshd_config settings. Sometimes, SSH can default to looking in an unexpected location if misconfigured. Make sure the line for AuthorizedKeysFile reads `%h/.ssh/authorized_keys` correctly, and consider restarting the SSH daemon again just to be safe.

Answered By CodeCrafter99 On

You might want to check the specific permissions of the user's home directory too. If the `.ssh` folder or its contents don't have the right ownership or permissions, SSH could be rejecting access for security reasons. They should be set such that only the user has access—typically `700` for the `.ssh` directory and also double-check the file permissions for authorized_keys there.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.