Created
December 21, 2021 00:24
-
-
Save grizmio/f0d5333899bafe8fd17063992b4bfe8a to your computer and use it in GitHub Desktop.
Please, never, ever, use me
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 SSH_AUTH_SOCK=$HOME/.ssh/ssh-agent.$(hostname).sock | |
env |grep -q "^DISPLAY=" | |
if [ $? -ne 0 ] ; then | |
export DISPLAY=:0 | |
fi | |
pidof ssh-agent >/dev/null 2>&1 | |
DONTSTOREMEHERE="PECO" | |
if [ $? -ne 0 ]; then | |
if [ ! -e $HOME/ssh_give_pass.sh ] ; then | |
/bin/echo -e '#!/bin/bash\nread SECRET\necho $SECRET\n' > $HOME/ssh_give_pass.sh | |
chmod +x $HOME/ssh_give_pass.sh | |
fi | |
ssh-agent -a "$SSH_AUTH_SOCK" | |
sleep 1 | |
SSH_ASKPASS=$HOME/ssh_give_pass.sh ssh-add $HOME/.ssh/id_ed25519 <<< "$DONTSTOREMEHERE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment