Mac OSX Server and SSH and VNC

Discussion in 'Mac OS X Server, Xserve, and Networking' started by wyattbiker, Dec 22, 2009.

  1. wyattbiker macrumors member

    Mar 7, 2009
    I've enabled VNC remoting on my server Snow Leopard

    I use the following command to login remotely to

    #ssh -l myusername

    which works fine but when I try to use VNC to view the desktop, it fails to connect. I installed Chicken of the VNC. Internally this works fine. I have all standard ports.

    Any ideas?

  2. TheCoupe macrumors member

    Mar 4, 2009
    Northern Ireland
    The reason, I believe, that this won't work, is because you aren't specifying the port number for which you are creating the secure tunnel in on, so in theory, you are simply creating a single secure tunnel in on port 22.

    If you are using Snow Leopard Server, why not simply create a VPN, that way, once you're connected, you'd have full access to everything you need.
  3. belvdr macrumors 603

    Aug 15, 2005
    Yes, use:
     ssh -L localhost:5900:<internal IP of host you want to connect to>:5900 <username>@<public IP or domain>
    Then when you fire up the VNC client, type localhost. Also note that some VNC servers and clients require this to be enabled for it to accept localhost.

    Depending on what network you connect to, outbound VPN may not be an option. Using SSH only gives you greater flexibility.
  4. Alrescha macrumors 68020

    Jan 1, 2008
    In addition, there's no need for Chicken of the VNC. You can use 'open vnc://hostname: <port> in Terminal to bring up Screen Sharing.


    ps: there's no space between the colon and portnumber, it's there only to avoid a smiley.
  5. wyattbiker thread starter macrumors member

    Mar 7, 2009
    Worked like a charm with Chicken using localhost, but the 'open vnc://hostname:5900' brings up a message on the server screen saying that a screen cannot share itself or something to that effect.
  6. Alrescha macrumors 68020

    Jan 1, 2008
    It is true that 'localhost:5900' is a special case. If you are using ssh as described by belvdr, I would suggest a different local port anyway, as you will have a conflict if you ever turn on screen sharing locally.

  7. warnerl macrumors newbie

    Feb 3, 2010
    My workaround

    The target computer must have file sharing selected, and the user name that you intend to use added. You can find this under system preferences > sharing > (then select which folder you want to share)

    Larry Warner
  8. belvdr macrumors 603

    Aug 15, 2005
    So enabling file sharing allowed vnc to connect to localhost?
  9. Serif macrumors regular

    Jul 10, 2008
    You can run into problems if you also have screen sharing enabled on the machine you are running the vnc client on. To avoid this use a port number other than 5900 for the localhost port of the ssh command. For instance:

    ssh -L localhost:6900:<internal IP of host you want to connect to>:5900 <username>@<public IP or domain>

    Then you should be able to connect to the remote machine as vnc://localhost:6900

    I find an application like SSH Tunnel Manager to be useful in automatically starting and maintaining ssh connections if you tend to use them regularly. If you look around someone has compiled the latest version for Intel.

Share This Page