SSH -L connection successful, but localhost port forwarding not working “channel 3: open failed: connect failed: Connection refused”

后端 未结 8 611
北恋
北恋 2020-12-02 15:28

My lab runs RStudio on a server. A couple weeks ago, from my cousin\'s house, I successfully ssh\'d into the server and pulled up the server-side RStudio through my local F

相关标签:
8条回答
  • 2020-12-02 15:47

    I had this problem when I wanted to make a vnc connection via a tunnel. But the vncserver was not running. I solved it by opening the channel on the remote machine with vncserver :3.

    0 讨论(0)
  • 2020-12-02 15:53

    Maybe its too late, but I ran into the same issue, and didn't want to map port by port, so I changed my /etc/ssh/sshd_config file and added:

    AllowTCPForwarding yes PermitOpen any

    Then just restart ssh

    0 讨论(0)
  • 2020-12-02 16:01

    Posting this to help someone.

    Symptom:

    channel 2: open failed: connect failed: Connection refused
    debug1: channel 2: free: direct-tcpip:
       listening port 8890 for 169.254.76.1 port 8890,
       connect from ::1 port 52337 to ::1 port 8890, nchannels 8
    

    My scenario; i had to use the remote server as a bastion host to connect elsewhere. Final Destination/Target: 169.254.76.1, port 8890. Through intermediary server with public ip: ec2-54-162-180-7.compute-1.amazonaws.com

    SSH local port forwarding command:

    ssh -i ~/keys/dev.tst -vnNT -L :8890:169.254.76.1:8890
    glue@ec2-54-162-180-7.compute-1.amazonaws.com
    

    What the problem was: There was no service bound on port 8890 in the target host. i had forgotten to start the service.

    How did i trouble shoot:

    SSH into bastion host and then do curl.

    Hope this helps.

    0 讨论(0)
  • 2020-12-02 16:02
    ssh -v -L 8783:localhost:8783 myacct@server.com
    ...
    channel 3: open failed: connect failed: Connection refused
    

    When you connect to port 8783 on your local system, that connection is tunneled through your ssh link to the ssh server on server.com. From there, the ssh server makes TCP connection to localhost port 8783 and relays data between the tunneled connection and the connection to target of the tunnel.

    The "connection refused" error is coming from the ssh server on server.com when it tries to make the TCP connection to the target of the tunnel. "Connection refused" means that a connection attempt was rejected. The simplest explanation for the rejection is that, on server.com, there's nothing listening for connections on localhost port 8783. In other words, the server software that you were trying to tunnel to isn't running, or else it is running but it's not listening on that port.

    0 讨论(0)
  • 2020-12-02 16:03

    Just replace localhost with 127.0.0.1.

    (The answer is based on answers of other people on this page.)

    0 讨论(0)
  • 2020-12-02 16:03

    This means the remote vm is not listening to current port i solved this by adding the port in the vm server

    0 讨论(0)
提交回复
热议问题