Skip to content

Instantly share code, notes, and snippets.

@jsynowiec
Created January 18, 2023 12:11
Show Gist options
  • Save jsynowiec/c35d86b823e51a64c7c789c240d7d59e to your computer and use it in GitHub Desktop.
Save jsynowiec/c35d86b823e51a64c7c789c240d7d59e to your computer and use it in GitHub Desktop.
The following command will create a new SSH key using ED25519 with an auto-generated comment and unique file name.
# Change the service variable to uniquely identify a service or area the key is intended for.
service="github" \
now=$(date +'%Y%m%d') \
name="$(whoami)@$(hostname -s | tr +'[:upper:]' +'[:lower:]')" \
sh -c 'ssh-keygen -t ed25519 -f $HOME/.ssh/id_ed25519_$name_$service -C "$name-$service-$now"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment