Error: "channel 3: open failed: administratively prohibited: open failed" on OS X Screen Sharing over ssh tunnel

kg23 picture kg23 · Dec 14, 2017 · Viewed 13.4k times · Source

I had configured OS X screen sharing over an ssh tunnel and at some point it stopped working. The ssh tunnel would work:

ssh -L 1202:localhost:5900 [email protected]

However, when attempting to make the screen sharing connection (vnc://localhost:1202), the remote host would error with

channel 3: open failed: administratively prohibited: open failed

Answer

kg23 picture kg23 · Dec 14, 2017

I have the following in my remote host's ~/.ssh.config:

AllowTCPForwarding yes
PermitOpen any

The missing element was an entry in the remote host's /etc/hosts that defined localhost. I added the following to that file and screen sharing over ssh tunnel was restored:

127.0.0.1 localhost