Created
February 17, 2018 09:52
-
-
Save YordanGeorgiev/c53b7fc02a780f52094b564ed0335889 to your computer and use it in GitHub Desktop.
public private key auth for ssh #linux #ssh #pkk
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
# START === how-to implement public private key ( pkk ) authentication | |
# create pub priv keys on server | |
# START copy | |
ssh-keygen -t rsa | |
# Hit enter twice | |
# copy the rsa pub key to the ssh server | |
scp ~/.ssh/id_rsa.pub $ssh_user@$ssh_server:/home/$ssh_user/ | |
# STOP copy | |
# now go on the server | |
ssh $ssh_user@$ssh_server | |
# START copy | |
cat id_rsa.pub >> ~/.ssh/authorized_keys | |
cat ~/.ssh/authorized_keys | |
chmod -v 0700 ~/.ssh | |
chmod -v 0600 ~/.ssh/authorized_keys | |
chmod -v 0600 ~/.ssh/id_rsa | |
chmod -v 0644 ~/.ssh/id_rsa.pub | |
find ~/.ssh -exec stat -c "%U:%G %a %n" {} \; | |
rm -fv ~/id_rsa.pub | |
exit | |
# and verify that you can go on the server without having to type a pass | |
ssh $ssh_user@$ssh_server | |
# STOP COPY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment