How to generate SSH public key to log into Linux VM | Azure Tips and Tricks

How to generate SSH public key to log into Linux VM | Azure Tips and Tricks


>>Learn how to generate
a SSH public key to automatically log into your Linux VM with
the Cloud Shell, in this edition of
Azure Tips and Tricks. Instead of always
needing to supply a password whenever I
log into my Ubuntu VM, I just want to be
able to SSH into it, and be able to be logged
in automatically. I want to use
SSH key gen command, and I want to generate an RSA public private pair
that I can use. I’ll accept it “False”. What I should see now is if
I CD into the.SSH folder. I should see two files, one named id_rsa and
one named id rsa pub. Now, what I want to
do is I want to take that rsa pub file and I want to secure
a copy that over to my VM. So, I’m going to copy
the IP address of my VM, and I’m going to log into it. I put in the password. Another file should
be copied over. Now, we need the SSH
into that same server. If I “Inspect” my home directory, I should see that file
be copied over. Next thing, I’m going to take that public key and
I’m going to “Append” it to my authorized keys
on this machine. There are two settings
I need to make sure are set inside of my SSH config. I need to make sure that
PubkeyAuthentication is turned on and also RSAAuthentication. Next, I want to
restart SSH service and this should be all we need. So, if I “Exit” this server, now back in my Cloud
shell environment. If I SSH into the server, notice how I can log right in without having to
put in a password.

Leave a Reply

Your email address will not be published. Required fields are marked *