Last active
November 4, 2015 16:49
-
-
Save johndaley-me/7af75f89dcacfb7184fc to your computer and use it in GitHub Desktop.
SSH help
This file contains hidden or 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
# setup passwordless ssh | |
# on the client machine | |
# 1. create ssh key pair | |
ssh-keygen -t rsa -b 4096 -C "[email protected]" | |
# 2. create authorized_keys file using the PUBLIC key (careful this will destroy an existing authorized_keys file) | |
scp id_rsa.pub [email protected]:/home/stacy/.ssh/authorized_keys | |
# Change permissions on .ssh directories and files if needed (on client and server) | |
cd ~/.ssh | |
chmod 700 . | |
chmod 640 authorized_keys | |
chmod 600 {your_key_files} | |
# test the connection from the client - should not get password prompt | |
ssh [email protected] | |
# Remove password on the server for extra security if you know what you're doing and don't need to sudo | |
passwd -d stacy | |
This file contains hidden or 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
# multiline, multicommand, execute remotely | |
ssh user@somehost 'export SOME_VAR=someValue\ | |
&& export ANOTHER_VAR=anotherValue\ | |
&& bash -s' < localscript.sh | |
# list fingerprints | |
ssh-keygen -l -f ~/.ssh/known_hosts | |
# list fingerprint of one host | |
ssh-keygen -l -f ~/.ssh/known_hosts -F myhost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment