leodutra
2/16/2016 - 4:13 AM

SSH RSA generation / usage on Windows Git tools SSH client + Ubuntu OpenSSH

SSH RSA generation / usage on Windows Git tools SSH client + Ubuntu OpenSSH

http://serverfault.com/questions/224810/is-there-an-equivalent-to-ssh-copy-id-for-windows

These answers didn't help me out. I really didn't need any crazy scripts. I had created a public key on my client machine in git bash and was trying to copy it to a VPS.

After creating your public key, the key should be stored as "(whatever folder you started in)/.ssh/id_rsa.pub"

So use this command:
cat ~/.ssh/id_rsa.pub | ssh user@123.45.67.89 "cat >> ~/.ssh/authorized_keys" where user is your username (sometimes "root", or whatever you may have set up), and replace 123.45.67.89 with your machine / host / VPS's IP address.

If the directory .ssh is not yet created on the host machine, use this small variation:
cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"