channel 3: open failed: connect failed: Connection refused

When using SSH -L <port>:localhost:<port> <destination> it means you are trying to do an SSH port forward.  This means that any traffic normally bound to <destination> is routed to the machine you executed the command on until you close the SSH connection.

If for instance you are trying to access the Proxmox webui which has its port active on 8006 you’d need something like:

ssh -L 8006:localhost:8006 192.168.1.25

If it is an Internet connection obviously the 192.168.1.25 would be changed to indicate the appropriate IP address and -p <port>.

Sometimes you will receive the message:

“channel 3: open failed: connect failed: Connection refused”

This means that you are trying to connect to a port that isn’t broadcasting.  This could be because you are actually trying to connect to the wrong machine or specified the wrong port.  For instance, I used the command to connect to my file server.  I meant to connect to the Proxmox computer.

In my case it would be:

ssh -L 8006:localhost:8006 proxmoxmachine

Then at my local computer I could open the web browser and enter:

https://localhost:8006 which would then receive the forwarded data from the proxmoxmachine.

“proxmoxmachine” might be an entry in your $home/.ssh/config file that corresponds to the proxmoxmachine and include such things as username, port, hostname, jumpserver proxycommand, etc.

Just bear in mind, that if you get the above error check ensure you are on the right machine that you want forwarded and that you are using the correct port #.