Skip to content

Instantly share code, notes, and snippets.

@FernandoCelmer
Last active June 22, 2023 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FernandoCelmer/4607f6539ed998ecfeaccfa0d8be94e1 to your computer and use it in GitHub Desktop.
Save FernandoCelmer/4607f6539ed998ecfeaccfa0d8be94e1 to your computer and use it in GitHub Desktop.
#!/bin/bash
read -p 'Email: ' email
ssh-keygen -t ed25519 -C $email
eval "$(ssh-agent -s)"
read -p 'SSH File Name: ' configfile
read -p 'Host Name: ' confighost
read -p 'Host Domain: ' configdomain
mv $configfile ~/.ssh/$configfile
mv $configfile.pub ~/.ssh/$configfile.pub
ssh-add --apple-use-keychain ~/.ssh/$configfile
echo -e "\nHost $confighost $configdomain\n AddKeysToAgent yes\n UseKeychain yes\n IdentityFile ~/.ssh/$configfile" >> ~/.ssh/config
echo -e "\n=====PUBLIC-KEY=====\n"
cat ~/.ssh/$configfile.pub
echo -e "\n=====PUBLIC-KEY=====\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment