I'm at a loss, I have followed the guide on https://www.linode.com/docs/applications/remote-desktop/using-vnc-to-operate-a-desktop-on-ubuntu-12-04 to configure my headless server to allow access via vnc. I have not used any ssh forwarding yet but just directly want to connect to the server on port 5901 and I can't, I only get a message saying Connection to host hostname::5901 was closed but I can confirm with ps ax | grep vnc that my server is running:$ ps ax | grep vnc21895 ?        S    158:03 Xtightvnc :1 -desktop X -auth /home/semios/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 120000 -rfbauth /home/semios/.vnc/passwd -rfbport 5901 -fp /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb -localhost22477 pts/5    S+     0:00 grep --color=auto vncand with netstat I can confirm that it is listening on port 5901:$ netstat -an | grep 5901tcp        0      0 127.0.0.1:5901          0.0.0.0:*               LISTEN so what might be wrong here?Also, I can not seem to find the logfile for Xtightvnc which might give me some more information...If I connect with $ ssh -p 2200 -X user@server and then connect my VNC client to 127.0.0.1:5901 I get the same message Connection to host 127.0.0.1::5901 was closed.
Problem accessing server with VNC
vnc;headless
Because you have invoked the VNC server with the -localhost parameter, it is only accepting connections on the localhost interface - as confirmed by the 127.0.0.1:5901 entry in your netstat output (an externally-open interface would read 0.0.0.0:5901). From the Xvnc manpage:   -localhost          Only  allow connections from the same machine. Useful if you use          SSH and want to stop non-SSH connections from any  other  hosts.          See the guide to using VNC with SSH on the web site.In this configuration you must tunnel the connection, else it will be refused. To tunnel over SSH, you can do something like:ssh -p 2200 -L5901:localhost:5901 user@remotehost -Nf(the -Nf is optional: it just puts the tunnel in the background) and then start your VNC client and point it at the tunnel endpoint: the details will depend on which client you are using, for examplevncviewer localhost:1