I login to a lot of Linux boxes, and I use ssh public keys to login. When I create a new account/server, I have to:
- copy over my ssh public key to the remote host
- login to the remote host
- put the public key in the authorized_keys file, set the permissions etc.
- delete the copy of the public key
I figured there ought to be an easier way to do this, and here it is:
cat .ssh/id_rsa.pub | ssh parijat@192.168.1.97 "mkdir -p ~/.ssh ; cat - >> ~/.ssh/authorized_keys ; chmod -R go-rwx ~/.ssh"
No comments:
Post a Comment