Bash: SSH with Tunnel

Syntax

ssh user@remoteHost.com -L 81:remoteHost:81

ssh user@192.168.0.112 -L 81:r192.168.0.112:81

Script

#!/bin/bash
function ssh-tunnel-112(){
        export $(grep -v '^#' .env | xargs)
        echo "ssh to .112:8081 to pi:3001"
        sudo ssh me@192.168.0.112 -L 8081:pi:3001
}
echo "creating tunnel on port 81"
ssh-tunnel-112

 

Tags