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

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


Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kg23