Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing ssh keys on a Ubuntu Azure VM from the Dashboard

I have an Ubuntu VM running on azure. I need to ssh connect to it but I have lost my private key since my home partition has gone. So, I reinstalled the OS on my local machine and regenerated a new pair pf private/public keys -- which I am already using for github, bitbucket, ecc. Is there any way to set my new public key on the Ubuntu VM from the Azure Portal?

like image 641
petrux Avatar asked Jul 24 '17 15:07

petrux


People also ask

Where does Azure store SSH keys?

SSH keys are by default kept in the ~/. ssh directory. If you do not have a ~/. ssh directory, the ssh-keygen command creates it for you with the correct permissions.

Can I change my SSH key?

To update your SSH key you first need to generate a new key as described here: Generate an SSH key pair. This should be done on your local machine (e.g. Windows / Linux / Mac). You MUST protect your key with a strong passphrase. Use a new, different passphrase whenever you generate a new key.


1 Answers

Actually, there is.

  • first you must start your VM
  • open the window for the VM from the Azure Portal
  • scroll down to reset password
  • select reset SSH public key for the Mode
  • select the proper user
  • paste the new public key in the SSH public key field
  • press the UPDATE button on top.

enter image description here

Just tested and worked fine for me.

like image 148
petrux Avatar answered Sep 17 '22 19:09

petrux