Created
March 19, 2018 20:49
-
-
Save dewittpe/071a0274ae8593e1534da9ded2ac6e6c to your computer and use it in GitHub Desktop.
Script to quickly setup ssh keys on remote machines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOST=git.neptuneinc.org | |
REMOTEUSER=pdewitt | |
KEY=/home/$USER/.ssh/id_rsa.pub | |
ssh -l $REMOTEUSER $HOST mkdir -p .ssh | |
cat $KEY | ssh -l $REMOTEUSER $HOST 'cat >> .ssh/authorized_keys' | |
ssh -l $REMOTEUSER $HOST "chmod 700 .ssh; chmod 640 .ssh/authorized_keys" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment