0

I'm trying to get a better understanding of authorized_keys in the context of an SSH server.

So if I have a linux server and I've placed a clients public SSH key into my servers authorized_keys file, that client may now login to the server. Presumably, this is the public key from a specific user on that client (new keys are generated for each user, right?).

If multiple users exist on my serer (root, user1, user2, etc.), then which user/profile (on the server) is the client allowed to access?

1

The authorized_keys file is not a per-server thing - it's a per-user-on-server thing.

If you want someone to access your server as "user1", you place their public key in ~user1/.ssh/authorized_keys. Now they can login as user1, and only user1.

If you want them to be able to login as other users, you need to copy their public key to the authorized_keys file of each target user. (Or you can user sudo to let them su to the other users.)

0

The authorized_keys file of an user account includes the public key of the client user which is allowed to login on this account and not the host key of the client host. This means a user could use the same key pair from multiple systems to login into a specific account. Also, multiple users on the same systems will have different key pairs and thus access is restricted to only the users which have the right key pair.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.