Last active
June 25, 2020 10:46
-
-
Save ollyg/2c5f136bfcf4a107665e616f8ff7faee to your computer and use it in GitHub Desktop.
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
# curl -f >> onto authorized_keys | |
# grep a_k for certs | |
# if more than two lines | |
# sed out the first N of them | |
curl -sf https://my-cert.pub >> ~/.ssh/authorized_keys && | |
sed -i '' '1!G;h;$!d' ~/.ssh/authorized_keys && | |
awk '!/^cert-authority / || ++n < 3' ~/.ssh/authorized_keys > ~/.ssh/authorized_keys.tmp && | |
sed '1!G;h;$!d' ~/.ssh/authorized_keys.tmp > ~/.ssh/authorized_keys && | |
rm ~/.ssh/authorized_keys.tmp && | |
chmod 600 ~/.ssh/authorized_keys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment