Last active
December 15, 2015 20:29
-
-
Save fclairamb/5319221 to your computer and use it in GitHub Desktop.
Add an SSH key with a password automatically. This can be added to bashrc for instance.
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
/usr/bin/expect >/dev/null <<EOF | |
set password mypassword | |
set key mykey.pub | |
spawn ssh-add /home/user/.ssh/$key | |
match_max 100000 | |
expect ":" | |
send -- "$password\r" | |
expect eof | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment