0

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 0.0.0.0:5555:127.0.0.1:80

enter image description here

Ultimately I need to access not 127.0.0.1 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.

mrid
  • 123
  • 5
  • "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*](https://superuser.com/a/1566917/432690). Please clarify what configuration file you mean. – Kamil Maciorowski Aug 29 '22 at 18:09
  • @KamilMaciorowski I think it was `ssh_config` file. Turned out I had modified the wrong file – mrid Sep 26 '22 at 13:55

0 Answers0