Last active
August 29, 2015 14:08
-
-
Save kodopik/4706dde39c39b3592034 to your computer and use it in GitHub Desktop.
add ssh-keys whith the same passphrase
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 | |
declare -r keys_dir='/home/user/.ssh/' | |
declare -r keys=' | |
key0.ppk | |
key1.ppk | |
key2.ppk | |
keyN.ppk | |
' | |
echo -n 'Passphrase: ' | |
read -s pass | |
echo | |
for key in $keys | |
do | |
expect > /dev/null 2>&1 << EOF | |
spawn ssh-add ${keys_dir}${key} | |
expect "Enter passphrase" | |
send "${pass}\r" | |
expect eof | |
EOF | |
done | |
ssh-add -l | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment