Last active
July 27, 2017 00:08
-
-
Save lizneu/cf282363336f5c093a19f1c114ad1537 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
mkdir ~/.ssh | |
cd ~/.ssh | |
PASSWORD=$(openssl rand -base64 30) | |
if [ "${#PASSWORD}" -ge 20 ]; then | |
ssh-keygen -b 4096 -P "$PASSWORD" -f id_rsa -o | |
echo "echo $PASSWORD" > /tmp/askpass.sh | |
chmod +x /tmp/askpass.sh | |
export DISPLAY=":0" | |
export SSH_ASKPASS="/tmp/askpass.sh" | |
ssh-add -K $HOME/.ssh/id_rsa </dev/null | |
rm /tmp/askpass.sh | |
else | |
echo "Something is wrong with the password." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment