I am halfway through a 6 months trip away from my Mac at home. Until yesterday I have been able to remote control this Mac using Screen Sharing over a ssh tunnel but suddenly I can't connect anymore.

This is how I open the tunnel

% ssh -v -p 2200  -l db -L 5901: remotecomputer

I can test that the service is running on the remote computer

% telnet localhost 5900
telnet: connect to address Can't assign requested address
Trying ::1...
Connected to localhost.
Escape character is '^]'.
RFB 003.889

But when I do something similar at my local computer

% telnet 5901
Connected to localhost.
Escape character is '^]'.
Connection closed by foreign host.

As you might have noticed I had enable verbose logging of my ssh connection and this is the output from ssh when I perform the test from the local machine

debug1: Connection to port 5901 forwarding to port 5900 requested.
debug1: channel 3: new [direct-tcpip]
channel 3: open failed: administratively prohibited: open failed
debug1: channel 3: free: direct-tcpip: listening port 5901 for port 5900, connect from port 58555, nchannels 4

I have:

  1. killed (-9) all sshd on the remote machine
  2. killed all ssh (-9) on the local machine
  3. restarted Screen Sharing on the remote machine (sudo launchctl unload /System/Library/LaunchDaemons/com.apple.screensharing.plist)
  4. Looked for suspicious open ports on both machines sudo (lsof -i -P | grep -i 590)

Everything to no avail. Finally I remotely logged into my router and turned on port forwarding from internet to the remote machine and I can connect that way (but it is very slow and not safe at all).

I have not changed anything (they always say so…) since it worked. The only thing that might have happened is that I left ssh/Screen Sharing running and had a network hiccup, not making a clean exit of something or so.

Any ideas? I think ssh is the culprit but I can't figure out how or why.

  • Found the log for ssh and all that is logged when I try to connect is Apr 12 11:41:32 mm sshd[71661]: error: connect to port 5900 failed: Can't assign requested address
    – d-b
    Apr 12, 2014 at 9:42
  • Daniel: I have no problems to open a ssh connection and your suggestions returns the expected result. Or did I misunderstand your suggestion?
    – d-b
    Apr 12, 2014 at 9:44
  • I now tried with other tunnels, both a static (AFP) and a dynamic (SOCKS proxy) and both returned error messages similar to the messages described above for VNC.
    – d-b
    Apr 12, 2014 at 9:49
  • I also tried to increase the MaxSession parameter in sshd_conf from 10 to 64. However I don't know if I need to restart sshd for that change to take effect. Problem is that I can't do that remotely (or can I?).
    – d-b
    Apr 12, 2014 at 9:50
  • I did that, my description was just a little brief. Though the readers would realise that since telnet localhost 5900 worked.
    – d-b
    Apr 13, 2014 at 7:49


You must log in to answer this question.

Browse other questions tagged .