One-liner to add public key to authorized keys
$ cat ~/.ssh/id_dsa.pub | ssh user@host "cat >> ~/.ssh/authorized_keys"
One Response to “One-liner to add public key to authorized keys”
Leave a Reply
You must be logged in to post a comment.
| | About Me | Blogs | Photos | Publications | Resume | |
$ cat ~/.ssh/id_dsa.pub | ssh user@host "cat >> ~/.ssh/authorized_keys"
You must be logged in to post a comment.
November 29th, 2006 at 9:57 pm
A better one liner:
$ cat ~/.ssh/id_dsa.pub | ssh user@host “cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys”
This will make sure that if the authorized_keys file did not exist, it will have the right permissions to allow login using it.