I'm trying to remotely access an external device connected to my linux device ( behind a firewall ) from a windows machine. I have a public server and have GatewayPorts set to yes in the ssh configuration file.

I'm unable to get it to work.

I'm connecting to the server from my linux machine using :

sudo ssh -i .....pem -N user@host -R

enter image description here

Ultimately I need to access not but another device connected on the ethernet port (it's pingable). Would that be possible? Suppose I want to connect that device's port 502 through the server ?

And when I check the opened ports on the server using sudo lsof -i -P -n | grep LISTEN, it shows the port open but only to localhost

enter image description here

I think that's why it's not accessible from my windows machine when I try to access it using my-server-hostname:5555.

Am I doing something wrong here?

Also I noticed that after manually terminating the ssh session on linux machine after a while keeps the port 5555 open on the server. This shouldn't happen.

  • "and have GatewayPorts set to yes in the ssh configuration file" – Ssh? Do you mean ssh_config and/or ~/.ssh/config? GatewayPorts in these affect -L. What matters for -R is GatewayPorts in sshd_config on the server. Please clarify what configuration file you mean. Commented Aug 29, 2022 at 18:09
  • @KamilMaciorowski I think it was ssh_config file. Turned out I had modified the wrong file
    – mrid
    Commented Sep 26, 2022 at 13:55


You must log in to answer this question.

Browse other questions tagged .