Set up SSH

There are several authentication methods into a VM, including an SSH public/private key pair or a username and password. We strongly recommend using key-based authentication (if you use a username/password, you'll be prompted to enter your credentials more than once by the extension). If you're on Windows and have already created keys using PuttyGen, you can reuse them.

Create an SSH key

If you don't have an SSH key pair, open a bash shell or the command line and type in:

ssh-keygen -t rsa -b 2048

This will generate the SSH key. Press Enter at the following prompt to save the key in the default location (under your user directory as a folder named .ssh).

ssh-keygen output

You will then be prompted to enter a secure passphrase but you can leave that blank. You should now have a id_rsa.pub file which containers your new public SSH key.

Next, you'll add the SSH key to your virtual machine SSH host.


I have an SSH key