Skip to content

Instantly share code, notes, and snippets.

@sethbergman
Last active October 28, 2018 21:00
Show Gist options
  • Save sethbergman/677c556d77f250d82b47bd09cd342df6 to your computer and use it in GitHub Desktop.
Save sethbergman/677c556d77f250d82b47bd09cd342df6 to your computer and use it in GitHub Desktop.
Add SSH Keys
# linux script to add a new ssh key to a bunch of different domains to which you have ssh access
# key_to_add.txt is a text file containing the ssh key and should be in the same directory
# add valid credentials for however many domains you need to add ssh keys for
# domain1 to add key to
cat key1.txt | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
# domain2 to add key to
cat key2.txt | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
# domain3 to add key to
cat key3.txt | ssh [email protected] 'cat >> ~/.ssh/authorized_keys'
# Replace this line with SSH key to add
# Replace this line with SSH key to add
# Replace this line with SSH key to add
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment