Created
May 28, 2020 08:26
-
-
Save adomingues/56b7af0bc31d992410b81b8a1b786aa7 to your computer and use it in GitHub Desktop.
Add a password to an OpenSSH private key generated without a password
This file contains hidden or 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
cd .ssh/ | |
mkdir -p ~/.ssh/backup_keys | |
## backup current keys just in case | |
for k in id_*; do | |
cp $k backup_keys/$k"_bak_$(date +"%m_%d_%Y")" | |
done | |
## it will ask for a password for every key file | |
for k in $(ls id_* | grep -v pub); do | |
echo $k | |
ssh-keygen -p -f $k | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment