--- layout: post title: "SSH Tricks" date: 2019-02-13 comments: true tags: ssh, shell, needs-js ---
SSH is omnipresent, its the standard in connecting to a remote machine, even windows is shipping it default (so I am told).
— Dhananjay Balan (@notmycommit) February 14, 2019
These are some less known (IMHO), but cool SSH features. Best way to read more is to read relevant section in *man ssh*
If you have to ssh to machines only accessible from another control machine, checkout *-J* flag. "ssh -J control_machine actual_machine"
— Dhananjay Balan (@notmycommit) February 14, 2019
GnuPG keys can also be your ssh key: There is no reason to maintain two sets of keys, you can use your gpg keys are ssh keys. Arch wiki has a nice explanation: https://t.co/sk5tub39Ad
— Dhananjay Balan (@notmycommit) February 14, 2019
If you do use gpg keys, you can store them on a @Yubico "Yubikey" (https://t.co/at94SwI1E1) or any supported hardware key(like @nitrokey). This ensures your keys are accessible only when they are plugged in, quite useful if you move around computers a lot.
— Dhananjay Balan (@notmycommit) February 14, 2019
You can shorten your complicated ssh commands by adding an entry in *~/.ssh/config* file. see *man ssh_config*
— Dhananjay Balan (@notmycommit) February 14, 2019
If you want to lend your SSH key to a host you ssh to (to ssh from the guest to somewhere else, git clone from github on guest etc) - checkout the *-A* flag.
— Dhananjay Balan (@notmycommit) February 14, 2019
SSH can act as a web proxy to fetch requests via your server. Quite handy as a quick and dirty vpn. Emphasis on quick n dirty - don't use this to replace a regular vpn.https://t.co/1VWG9rT70U
— Dhananjay Balan (@notmycommit) February 14, 2019
SSH can create a reverse shell](https://t.co/JQlxzi1ocJ), useful if you want to expose a machine behind NAT outside.
— Dhananjay Balan (@notmycommit) February 14, 2019
I am sure SSH can do much more! Whats your nifty less known SSH feature?
— Dhananjay Balan (@notmycommit) February 14, 2019