Link to this headingSSH
Scan SSH for bad configurations
Scan SSH for bad configurations
SSH Cheat Sheet
Link to this headingGenerating Keys
Generate new ED25519 Curve Keys:
Link to this headingGenerate Keys on a YubiKey
Generate Key with other Authentication Factors:
Adding Keys:
Link to this headingSSH User Config
Located at ~/.ssh/config
Link to this headingSSH Multiplex using ControlPath
ControlPerisist keeps the socket open for X mins after the shell has been closed. This allows easier reconnection.
ControlMaster this makes it faster to make multiple connections to the same server.
ControlPath where to store the information
Link to this headingProxy using SOCKS
Link to this headingEnable Socks Proxy on Chrome
In Firefox select Preferences -> General | Network settings and add 127.0.0.1 and 8888 for the port. There is also an option to proxy DNS requests using the SOCKS proxy.
Link to this headingEnable Socks Proxy on Chrome
Using the Command below the browser will proxy the data over the SOCKS proxy and will also proxy the DNS requests.
Link to this headingUsing Proxychains
Link to this headingReverse Proxy
The example below sets up a proxy from the remoteserver port 1999 to the localhost. Then the remoteserver is able to set up a SOCKS proxy using localhost:1999 and be forwarded through to client ssh computer.
Link to this headingSSH Port Forwarding (Tunneling)
The example below uses ssh to forward the remote port 80 to the local port 9999. This means that going to 127.0.0.1:9999 will tunnel out to the remoteserver and connect to port 80. Since the ssh will go to server port 80 does not need to be accessible to the rest of the internet.
Link to this headingSSH Tunnel Forward to Secondary Remote host
The example below uses the remoteserver as a jumpbox to connect to another system with the ip address 10.10.10.10 in the local network of the remoteserver. It then forwards the localhost port 1999 to the internal IP of 10.10.10.10:80
Link to this headingSSH reverse Port Forwarding (Tunneling)
The example below forwards the remoteserver port 1999 to the localhost port 902. This means that if an external client connects to port 1999 on the remote server they will get the localhost port 902 instead.
Link to this headingEstablish a VPN over SSH
Must have sudo/root access on both the client and server.
You might also need to change the sshd_config.
The ssh command is:
SSH Client Side:
SSH Server Side:
SSH Client Side:
Now it is possible to make the internal subnet accessible. This makes it a half tunnel VPN.
SSH Server Side:
Link to this headingCopy SSH id file to remote host
Link to this headingRun commands
Link to this headingNon-interactive command
Run the command on the remote computer and then use grep locally.
Send piped information to remote server.
Link to this headingRemote Packet Capture in Wireshark
Capture packets on remote host and view locally in Wireshark.
Link to this headingSSH Copy Folder from Local to Remote
Tar and send a directory through a pipe to the remoteserver and untar the data.
Link to this headingRun a GUI application remotely
X11Forwarding needs to be enabled in the sshd_config
Link to this headingEdit Files with vim over SSH
Link to this headingCopy files remotely with rsync and SSH
Link to this headingSSH over TOR Network
Link to this headingMount SSH to a directory
Link to this headingVLC to Stream over SSH
vlc sftp://remoteserver//media/uploads/myvideo.mkv
Link to this heading2FA
Setup Two factor (2FA) SSH with Google Authenticator
Link to this headingBouncing through jump hosts
To use this ability in the ssh_config use the ProxyJump configuration option. If you regularly have to jump through multiple hosts; use the config file and your alias to host4 will save you a lot of time.
Link to this headingSecuring sshd_config
Link to this headingChange the default SSH Port
Link to this headingModify Port Forwarding within a session with ~C
Within a SSH session using ~C[ENTER] will show forwarding options.
NOTE: zsh doesnt work with this. You need to use bash
Link to this headingClose Hung SSH connection
“Enter” then ~ then . will kill a hung SSH connection, instead of having to close the terminal tab