Saturday, October 23, 2021

[SOLVED] SSH local port forwarding doesn't work, opens a TTY connection instead

Issue

I’m trying to forward a remote port on a server on Digital Ocean to a local port. This is the command I’m using:

ssh -R 9000:localhost:3000 root@<server IP>

But instead of forwarding the port, this command opens a terminal connection. Is my SSH misconfigured? What might be the issue?


Solution

Try running

ssh -fNT -R 9000:localhost:3000 root@<server IP>

-fNT will put ssh in the background, not execute a remote command and disable pseudo-tty allocation.



Answered By - Oliver