Last active
May 7, 2019 02:27
-
-
Save o0-o/48dd41ab289e5b4324c246af4fc8df2d to your computer and use it in GitHub Desktop.
[Create SSH Key] Generate and install an SSH key #Shell
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
| # ssh_key_create.sh | |
| # | |
| # parameter: user@host | |
| # example: [email protected] | |
| ( # try ed25519 | |
| ( ssh-keygen -t ed25519 -b 4096 -f "~/.ssh/$1" && | |
| ssh-copy-id -i ~/.ssh/"$1" "$1" | |
| ) || | |
| # fallback to rsa | |
| ( ssh-keygen -t rsa -b 4096 -f "~/.ssh/$1" | |
| ssh-copy-id -i ~/.ssh/"$1" "$1" | |
| ) | |
| ) 2>/dev/null || | |
| exit 1 #failure | |
| exit 0 #success | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment