Uploading multiple SSH Keys to One VM

forestfire 41 Reputation points
2021-08-31T14:43:52.473+00:00

Hello,

My team is currently having trouble establishing a connection with the virtual machine we created using an SSH key. The team member who created the VM is unable to gain a connection with the machine using the SSH key he created during the VM creation steps.

After the VM was created I went and made an SSH key for myself using azure portal and saved the .pem file on my computer but I am unable to establish a connection using it aswell. I tried creating the key using PuTTyGen and then logging in via PuTTY but that also did not work.

Is there a way to upload multiple SSH public keys to one VM so that different users can access the machine?

Thanks

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,586 questions
0 comments No comments
{count} votes

Accepted answer
  1. prmanhas-MSFT 17,901 Reputation points Microsoft Employee
    2021-09-02T16:05:02.57+00:00

    @forestfire Apologies for the delay in response and all the inconvenience caused because of the issue.

    Yes it is possible. ssh key is just like password, multiple users = multiple passwords,similarly mutiple users = multiple keys
    Firstly can you please check if the below method and let me know if you are able to SSH to your VM or not?

    • Create Azure VM using the steps mentioned here
    • Now keep the key setting to Generate new Key Pair as below: 128719-image.png
    • Click on Next you will get option to save public and private key and proceed for VM creation: 128690-image.png
    • Now once VM is created go to Connect option and copy below data: 128650-image.png
    • Now if you have a Windows machine open Powershell and paste the above and change the private key path with the path of file you downloaded in Step 2 and Click Enter : 128784-image.png
    • You are now connected to VM and you can check same as below: 128785-image.png
    • Similarly in case of Putty method select already existing key option on Azure Portal while VM creation In PuttyGen Generate a new key and download Private and Public Key to your machine. Copy the Public Key Value and paste it in the space for Already existing key on Azure Portal as below: 128764-image.png 128821-image.png
    • Now Click on Review and Create.
    • Copy the value of Public IP of VM from the portal: 128735-image.png -Open Putty on your system and paste the copied IP value to Session > Hostname: 128765-image.png -Click on SSH option on right.Click on Auth > on bottom under Auth Parameter for Private file click on Browse and select the Private key you saved after generating from PuttyGen: 128736-image.png

    -Click on Open. It will prompt you as below select Yes:

    128802-image.png

    • Now once you get screen put the username which you entered while VM creation click enter and you are good to go : 128794-image.png

    Same will hold for any method.

    Now for multiple for multiple keys you can follow something as mentioned here. Also as mentioned here Your public key can be shared with anyone, but only you (or your local security infrastructure) should have access to your private key. One more doc here

    Hope it helps!!!

    Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.

    Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as convenient to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


0 additional answers

Sort by: Most helpful