Skip to content

Instantly share code, notes, and snippets.

@pvspain
Last active September 18, 2020 08:03
Show Gist options
  • Save pvspain/7085053f7cc44792782dec8e3ca07959 to your computer and use it in GitHub Desktop.
Save pvspain/7085053f7cc44792782dec8e3ca07959 to your computer and use it in GitHub Desktop.
New ssh user keys
KEY_PATH="${HOME}/.ssh"
# No error if directory exists
mkdir --parents ${KEY_PATH}
pushd ${KEY_PATH} > /dev/null
# Create/overwrite RSA key pair (4096 bits)
echo -e 'y\n' | ssh-keygen -b 4096 -t rsa -N "" -f id_rsa > /dev/null
# Create/overwrite ED25519 key pair
echo -e 'y\n' | ssh-keygen -t ed25519 -N "" -f id_ed25519 > /dev/null
printf "\nPaste these public keys separately into your Git portal account(s)...\n"
printf "Context: ${USERNAME}@$(hostname)\n\n"
ssh-keygen -y -f id_rsa
printf "\n"
ssh-keygen -y -f id_ed25519
printf "\n"
popd > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment