0

I need to create a tunnel in a remote MS-windows, so the port 443 in MS-windows is redirected to a remote target on port 443.

What I'm trying to do is this, from my remote server:

ssh -N -R 443:remote.target:443 [email protected]

But I get this error:

Warning: remote port forwarding failed for listen port 443

In the windows server I installed OpenSSH.

The tunnel works if I use the 8443 port in windows, eg:

ssh -N -R 8443:remote.target:443 [email protected]

But I need do do the tunnel with 443. I tried to better configure OpenSSH ("AllowTcpForwarding yes", "PermitTunnel yes" and "GatewayPorts yes" and I tried also to restart the sshd service as an administrator), but it didn't work.

2
  • Are there 3 machines involved? Feb 21, 2020 at 11:19
  • Yes, there is - one server with a service on port 443 to which I have to connect to - my server that is used to do the tunnel - the windows server that needs to connect to the first one and that cannot do directly
    – luandrea
    Feb 21, 2020 at 12:43

2 Answers 2

1

It may be because the port is reserved. Ports below 1024 are reserved on many OSs. To use them you have to have special permission (e.g. be root user).

Try a higher port number. If this works then you know what the problem is. (Only the listening port has to be higher.)

6
  • I was thinking the same, but I need to do the tunnel on that port. I'm already connecting using the administrator account in the Windows server, maybe there is a perticular connection on OpenSSH?
    – luandrea
    Feb 21, 2020 at 12:41
  • Have you tested on another port? That way you will know if this is the problem. Feb 21, 2020 at 15:58
  • Yes, I tested using another port and it is working. I also tried to change some OpenSSH settings, like "AllowTcpForwarding yes", "PermitTunnel yes" and "GatewayPorts yes" and I tried also to restart the sshd service as an administrator, but I didn't notice any difference. The sshd_config file is read correctly, because if I change ssh port, I have to use it to be able to connect.
    – luandrea
    Feb 21, 2020 at 16:07
  • OK. Then edit the question to tell us what does work, and what does not (low numbered ports). Feb 21, 2020 at 16:16
  • I don't see a way to edit the question, I can only add comments under it.
    – luandrea
    Feb 21, 2020 at 16:39
0

I encountered the same problem on Windows Server 2019 where I installed "OpenSSH Server" with "Manage optional features" and configured

AllowAgentForwarding yes
AllowTcpForwarding yes
GatewayPorts yes

I'm getting the same error as you.
The ports that can be used are in the range 1001 to 65535.
I'm still stuck on this problem. and using the command netstat -an did not find any program using port 443.
I tested further using the network testing tool. .\iperf3.exe -s -p 443 on Windows Server and on client machines use the command .\iperf3.exe -c windows.source -p 443 can be used without any problems found.

1
  • Since there is neither a solution nor a description on how to narrow it down, this should rather be a comment to the question. Or can you edit it into a (focused) answer?
    – fheub
    Oct 13, 2023 at 8:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .