Created
May 30, 2017 21:04
-
-
Save kamilziajka/34c24ebbd5c2aa351c915537a3a02e4c to your computer and use it in GitHub Desktop.
ssh-keygen
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/env bash | |
# ./ssh-keygen.sh ~/test | |
# will create ~/test-public-key and ~/test-private-key | |
function keygen { | |
local key_path="${1}" | |
local key_public_path="${key_path}-public-key" | |
local key_private_path="${key_path}-private-key" | |
rm -f "${key_public_path}" "${key_private_path}" | |
ssh-keygen -f "${key_path}" -C '' -N '' -t rsa | |
mv "${key_path}" "${key_private_path}" | |
mv "${key_path}.pub" "${key_public_path}" | |
chmod 600 "${key_public_path}" "${key_private_path}" | |
} | |
path=${1:-"ssh"} | |
keygen "${path}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment