Created
March 30, 2022 16:55
-
-
Save dougpagani/cd0354c5b204001166c8446c410cb977 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
ssh-isolate-access() { | |
cat ~/.ssh/id_rsa.pub | command ssh "$@" ' | |
cat > ~/newakeys; | |
nohup bash -c '"'"'trap "" HUP; echo $$ > ~/killme && sleep 10 && mv -f ~/authorized_keys ~/.ssh/authorized_keys;'"'"' </dev/null &>/dev/null & disown; | |
mv ~/.ssh/authorized_keys ~/authorized_keys && | |
mv ~/newakeys ~/.ssh/authorized_keys; | |
echo DONE: close connection | |
' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment