3

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?

raphael
  • 169

1 Answers1

7

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 ssh-user@server.example.com -NT

Session #2:

ssh -L 8081:127.0.0.1:80 ssh-user@server.example.com -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.

siwyd
  • 86
  • 2
    Just for completeness for other readers in slightly different scenarios, let's also note that of course, the reverse won't be true: if you use reverse port forwarding (-R) the port on the remote server can't be the same for multiple users. – jcaron Aug 26 '21 at 22:44