Last active
December 19, 2015 15:03
-
-
Save PieterScheffers/cbde6af6d056b87f65ee to your computer and use it in GitHub Desktop.
SSH Based Authentication
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
# https://forums.freebsd.org/threads/howto-setting-up-public-key-password-less-ssh-access.1508/ | |
# http://unix.stackexchange.com/questions/42643/ssh-key-based-authentication-known-hosts-vs-authorized-keys | |
# https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-freebsd-server | |
# Generate key on client | |
ssh-keygen -t rsa | |
# Generate key on server | |
ssh-keygen -t rsa | |
# Get public key on client | |
cat ~/.ssh/id_rsa.pub | |
# Add to authorized_keys on server | |
nano ~/.ssh/authorized_keys | |
# --> paste client public key | |
# connect from client to server | |
ssh -p 2222 someuser@somehost | |
# type 'yes' to accept server and add key to ~/.ssh/known_hosts file | |
######################### | |
# Add client public key to authorized_keys file of server | |
ssh-copy-id -i ~/.ssh/id_rsa.pub -p 2222 someuser@somehost | |
cat ~/.ssh/id_rsa.pub | ssh -p 2222 someuser@somehost "cat >> ~/.ssh/authorized_keys" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment