Last active
August 29, 2015 14:09
-
-
Save AndrewRussellHayes/1aa2df507c0684292049 to your computer and use it in GitHub Desktop.
SSH keygen steps
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
#make ssh directory | |
mkdir ~/.ssh | |
#change mode to 700 | |
chmod 700 ~/.ssh | |
#Generate new Key | |
ssh-keygen -b 2048 -t rsa -f [keyname] -P ["password"] # "" for passwordless key.. this is unsafe | |
#Default Key. | |
ssh-keygen -b 2048 -t rsa -f id_rsa -P ["password"] | |
#Add public key to ssh_pubs directory | |
cp .ssh/*.pub .ssh/ssh_pubs/ | |
#Get Key contents | |
cat [keyname].pub | |
#Default Key. | |
cat id_rsa.pub | |
#Add Key to ~/.ssh/authorized_keys file | |
#allow write on keys file | |
chmod u+w authorized_keys | |
#add Key | |
echo id_rsa.pub >> authorized_keys | |
#when done make read only | |
chmod u-w authorized_keys | |
#to force key, use | |
ssh -i /.ssh/[keyname] user@server.host | |
#~/.ssh/config SSH Client Configuration | |
#Add both host names and their identity file: | |
Host server.host | |
IdentityFile ~/.ssh/keyname | |
Host OSXserv.local | |
IdentityFile ~/.ssh/id_rsa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment