How to access VNC on a Linux server without having been logged in to the machine first? [duplicate]

Possible Duplicate:
Automatically start VNC server on startup

I have a Linux server at home, and by default no-one is logged in to that box.

I'd like to establish a remote desktop connection to it with VNC but this fails, unless I log in first physically.

It's strange to me that VNC Viewer doesn't even ask for credentials, it just displays a "connection refused" error message.

What's the best way to do this? I'm running Ubuntu 10.04 on the server.


Solution 1:

I believe that vnc is not the same as windows remote desktop - it is for screen sharing so if you are not logged in the vnc service won't be running.

The solutions would be to set your home server to log in automatically or run an xserver on your remote computer and connect using ssh/putty. I used to use cygwin and always connected to my ubuntu box with ssh -X but just tried out xming and am impressed. After a full install if you run xlaunch, set to run fullscreen, and run gnome-session remotely connecting with putty - it is just like remote desktop and seems quicker than vnc on my lan.

Solution 2:

VNC and remote desktop operate on different principles. The basic operating model for remote desktop is that it gives you access to the remote machine's actual, physical display; it doesn't give you a remote connection to the machine independently of what the local user is doing. The basic operating model for VNC is that it provides a virtual display that you can connect to remotely; VNC operates independently of what a local user may be doing.

If you want to run graphical applications on your Linux machine and have them display on your local machine, VNC is not the first tool that comes to mind. The unix way of doing this is to use ssh -X to connect to the remote machine; then remote X applications are displayed on the local X display. This does require that you have an X server locally; for Windows, this requires yet another program to be installed and set up.

If you want to be able to start a graphical application on the Linux machine, and connect to it from anywhere in the world, run a VNC server (vncserver command). This creates a virtual display that you can connect to from anywhere (barring firewalls). Run a VNC client to see what is displayed on that virtual display.

If you want to have direct access to the X server that is displaying on the Linux machine's monitor, check out x2vnc.