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:127.0.0.1:5900 remotecomputer
I can test that the service is running on the remote computer
% telnet localhost 5900
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: 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 127.0.0.1 5901
Trying 127.0.0.1...
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 127.0.0.1 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 127.0.0.1 port 5900, connect from 127.0.0.1 port 58555, nchannels 4
I have:
- killed (-9) all sshd on the remote machine
- killed all ssh (-9) on the local machine
- restarted Screen Sharing on the remote machine (sudo launchctl unload /System/Library/LaunchDaemons/com.apple.screensharing.plist)
- 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.