Ok, finally I got VNC over SSH tunnel working on LAN, but the objective is to use it on Internet, so I'm a little worried about the open ports the server has. Scanning the ports, I can see these ports open: 22, 5900 and 6000.

The steps I've given so far are these:

  • Installation of 'vnc4server' on server.

  • Edit /etc/init/vnc-server.conf so it looks like this:

    # vnc-server.conf
    start on runlevel [2345]
    stop on runlevel [016]
    post-start script
            su remote_user_name -c '/usr/bin/vnc4server :0 -geometry 1024x768'
    end script
    post-stop script
            su remote_user_name -c '/usr/bin/vnc4server -kill :0'
    end script
    #End of File
  • Set the VNC password by executing:

    $ su remote_user_name -c 'vnc4server :0 -geometry 1024x768'
  • Edit xstartup so it looks like this:

    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    xsetroot -solid grey
    vncconfig -iconic &
    x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    x-window-manager &
    gnome-session --session=gnome-classic  &
  • Finally I restart the VNV server (start -vnc-server, stop -vnc-server).

  • On the client side, I'm using Remmina to make the connection, with this configuration on SSH tab:

    Enable SSH tunnel <- checked
    Tunnel via loopback address <- unchecked
    SSH port: 22 (I'ts my mind to change it, but later)
    SSH Auth: Password (I know how to make it with Pub-key; I'll do it later)

Well... I want to have the server on a remote LAN, and I don't like having 5900 and 6000 ports open... Should I? Is that the way it must be configured?

1 Answer 1


Ok, solved: Obviously 5900 and 6000 can't be accesible from any IP but localhost.

Perhaps it will help someone a bit confused as me, so I'll leave the post.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .