Last active
June 30, 2018 21:22
-
-
Save wilcollins/bc420581da87962b8b47 to your computer and use it in GitHub Desktop.
SSH KeyGen+Copy Bash Script (quick ssh key setup)
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
#!/bin/bash | |
# | |
# Creates an SSH key on a client machine, applies the appropriate file permissions, | |
# copies to the local ~/.ssh directory, & copies to specified server | |
# | |
# parameters: | |
# ..1 newKeyFileName | |
# ..2 user@server | |
# | |
# usage : | |
# ./sshKeyGen.sh newKey [email protected] | |
# | |
ssh-keygen -t rsa -f $1 | |
chmod 600 $1 | |
chmod 600 $1.pub | |
mv $1 ~/.ssh/$1.pem | |
cp $1.pub ~/.ssh/$1 | |
mv $1.pub ~/.ssh/$1.pub | |
ssh-copy-id -i ~/.ssh/$1.pub $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment