-
-
Save vlrmprjct/6e2853e3b5717fee521905d12a2b2790 to your computer and use it in GitHub Desktop.
SSH KeyGen+Copy Bash Script (quick ssh key setup) #ssh #linux
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 user@server.com | |
# | |
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