astroame
astroame

Reputation: 399

Microsoft Azure Linux Virtual Machine SSH Public-private Keys Authentication for multiple users

I understand that one could connect to a Virtual Server by either SSH Public-private Keys Authentication OR by merely using a username and password.

If SSH Public-private Keys Authentication type is used and i decide to give another user access to the server, must I share my private key with him or he can create his own private key that would still work with the public key on the Virtual Machine?

Upvotes: 0

Views: 806

Answers (1)

Charles Xu
Charles Xu

Reputation: 31424

For the SSH key, the public key and the private key are one to one. So the first, you can use the same private key to access the VM from different on-premise machines via the same user.

And second, if you want to use the same public key for different users, then you need to share the public key with different users in the VM by setting the authorized_keys file. It means you need to add the authorized_keys file in each users' /home/user/.ssh path.

Update:

Here is the screenshot that adds or updates the user with the public SSH key for the existing VM:

enter image description here

Upvotes: 1

Related Questions