Last active
April 19, 2019 09:50
-
-
Save EmperorRXF/c6e109cb6231f9a2c09b7ddfbdc63eec to your computer and use it in GitHub Desktop.
Import Putty PPK files into Linux OpenSSH Agent
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 | |
DEFAULT_PPK_PATH=/mnt/UltraDisk/Dev/SSH-Keys | |
read -e -i $DEFAULT_PPK_PATH -p "Path to PPK Files to Import: " PPK_PATH | |
if [ -z "$PPK_PATH" ] | |
then | |
echo "Nothing Imported!" | |
else | |
for FILE in "$PPK_PATH"/*.ppk; do | |
[ -e "$FILE" ] || continue | |
SHORT_NAME="$(basename -s .ppk $FILE)" | |
puttygen "$FILE" -O private-openssh -o "$HOME/.ssh/id_rsa_$SHORT_NAME" | |
puttygen "$FILE" -L > "$HOME/.ssh/id_rsa_$SHORT_NAME.pub" | |
ssh-add "$HOME/.ssh/id_rsa_$SHORT_NAME" | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment