Skip to content

Instantly share code, notes, and snippets.

@kodopik
Last active Aug 29, 2015
Embed
What would you like to do?
add ssh-keys whith the same passphrase
#!/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