Is it possible to have multiple users SSH tunnel to a same local port?

I have a web-app running on a particular port on a Linux EC2 instance. Only SSH traffic is allowed to that server.

Can multiple clients use SSH tunnels to that server to load a webpage from that port?


Solution 1:

Definitely. You can easily try this with your own user. Just open up two terminals and start two SSH sessions to proxy that same server port.

Session #1:

ssh -L 8080:127.0.0.1:80 [email protected] -NT

Session #2:

ssh -L 8081:127.0.0.1:80 [email protected] -NT

Notice I used two different local ports (8080 and 8081), otherwise the second session would error out. When multiple users connect from different machines, that won't apply.