Tmux shortcuts & Cheatsheet
# Tmux shortcuts & cheatsheet start new: tmux start new with session name: tmux new -s myname attach: tmux a # (or at, or attach) attach to named: tmux a…
Continue reading...Hey, I Akhil Raghav
# Tmux shortcuts & cheatsheet start new: tmux start new with session name: tmux new -s myname attach: tmux a # (or at, or attach) attach to named: tmux a…
Continue reading...SSH tunneling and port forwarding snippets and utils
SSH local-port-forwarding. You want to be able to access a service or website that your firewall is preventing you from accessing but you know it is available from the remote server.
ssh -fNL LOCAL-IP:LOCAL-PORT:REMOTE-IP:REMOTE-PORT username@remote-host
ssh -fNL LOCAL-IP:LOCAL-PORT:REMOTE-URL:REMOTE-PORT username@remote-host
# Example 1 # If you want to access a service that is running on the remote server port 8888, # but there is a firewall that is preventing you from accessing the port 8888 from the browser. # For example you would like to do this from the browser but cannot, remote-host:8888 # After running the following command you can access the service from your local browser, localhost:8080 $ ssh -NL 0.0.0.0:8080:localhost:8888 username@remote-host # Example 2 # If you are not able to access google.com from your local system but the remote server is able to access it. # After running the following command you can access the google.com from your local browser, localhost:8080 $ ssh -NL 0.0.0.0:8080:google.com:80 username@remote-host
-L
: Local Port forward and open a remote shell.-NL
: Local Port forward but do not open a remote shell-fNL
: Local Port forward, do not open remote shell, and send this into the background.One use case for using remote port-forwarding is if a local machine is stuck behind a vpn or firewall and it needs to be accessed by a remote machine. Simple ssh will suffice but we use autossh to keep the connection reliably open for a long period of time.
Allow SSH into first machine (local) from second (remote) and (third part) machine
Open up ssh port on the first machine, such that it can be accessed by the second machine. We will use the first, second and third to mean the same machine in all examples.
# Usage $ autossh -M ECHO_PORT_1 -fNR IP-ON-SECOND:ACCESS_PORT:IP-ON-FIRST:SSH-PORT second-user@second-host # Example $ autossh -M 20000 -fNR 0.0.0.0:8080:localhost:22 second-user@second-host
# Usage $ ssh first-user@second-host -p ACCESS_PORT # Example $ ssh first-user@locahost -p 8080 ### OR $ ssh first-user@0.0.0.0 -p 8080
# Usage $ ssh first-user@second-host -p ACCESS_PORT # Example $ ssh first-user@second-host -p 8080
Tested on: YU Yureka Black (with android 11 custom rom and GSI )Requirements. Rooted Android device. Busybox installed. I recommend “Busybox“ app by Stephen (Stericson). A terminal for Android. For…
Continue reading...