How to setup ssh for Azure linux VM from Mac OS X so that it does an auto login without password

When I setup my Linux VM, I choose username rather than public key ssh key, as I had problems moving the ssh keys betwen clients. Anyways long story, I login using ssh -l username remotehost from my MacBook every time I login, and never bother to setup the public keys to login without a password.

The solution was surprisingly easy.

From my MacBook, You need to run the following:

ssh-keygen  

This Generates the public/private rsa key pair and saves the private key to /Users/username/.ssh/id_rsa) and the public key to
/Users/username/.ssh/id_rsa.pub.

Once configured, you can copy the public key to the linux vm like this:

ssh-copy-id  username@remotehost

of course replacing the username and remote host with your Azure Linux vm login and the Azure Linux vm public url or ipaddress.

You can get this from here: