I just got a new computer and I connect to 3 different remote machines using ssh. They all have logging in with password turned off so I have to have a key. What is the best way to copy my newly generated key to these machines without having to take down my walls?
Asked
Active
Viewed 4,927 times
1 Answers
2
Depending on your OS, you can try:
ssh-copy-id username@host
To specify the key file use:
ssh-copy-id -i ~/.ssh/id_rsa.pub username@host
You may have to copy your public key to a computer that already has SSH access to the three machines, otherwise these commands won't work without asking for a password.
I find this is much easier than using my old method:
cat ~/.ssh/id_rsa.pub | ssh username@host 'cat >> .ssh/authorized_keys'
Jamie S
- 141