Skip to content

Instantly share code, notes, and snippets.

@netrunn3r
Last active December 11, 2017 07:25
Show Gist options
  • Save netrunn3r/6ab8ac250886042fd57f70bac098213f to your computer and use it in GitHub Desktop.
Save netrunn3r/6ab8ac250886042fd57f70bac098213f to your computer and use it in GitHub Desktop.
SSH cheatsheet

Passwordless

  1. Generate key (if necessary): ssh-keygen -o -a 100 -t ed25519
  2. Add content of the PUBLIC key to ~/.ssh/authorized_keys file on the server
  3. Check that ~/.ssh has 700 and ~/.ssh/authorized_keys has 600 perm (on server)

Config file

Create ~/.ssh/config file:

VisualHostKey=yes 

Host <name>
Hostname <hostname>
Port <port>
User <user>
IdentityFile /home/<user>/.ssh/<keyfile>

Then you can connect like that:
ssh <name>

sshuttle

'vpn' via ssh sshuttle -e 'ssh -i ~/.ssh/id_ed25519' -r user@10.20.30.140 10.10.100.0/24
-e - pass cmd to ssh, here use key
-r - remote host where we have ssh
10.10.100.0/24 - network to which we want to have access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment