Edit /etc/ssh/sshd_config
:
AllowTcpForwarding yes
GatewayPorts yes
Restart or reboot.
ssh -o StrictHostKeyChecking=no -N -R <remoteport>:localhost:<localport> -p<sshport> <[email protected]>
In a shell script, use sshpass
to supply password and append an &
to run in background.