Created
October 21, 2017 09:40
-
-
Save thstarshine/0fcfe407de1551e4db415ff249b2c9f3 to your computer and use it in GitHub Desktop.
replace ssh authorized_keys by sed
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 | |
export NEW_SSH_KEY=ssh-rsa\ ....\ user@host | |
sed -e "s#ssh-rsa.*OLD_KEY_ID#$NEW_SSH_KEY#" ~/.ssh/authorized_keys | |
# ssh root@host 'bash -s' < this_script.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment