- This "server" is a desktop install (ie the
ubuntu-desktop meta package is installed)
- Server sits behind a router which connects to the internet and shares it out through NAT
- Your user is set to auto-login
- You're trying to connect from outside your home network. I had rather assumed you were trying to do this from work but now realise that may not be the case.
Step one: Make your internet connection locatable.
Most ISPs give their users dynamic IPs. This is as much (try to) stop people hosting things as it is protecting them from people who find out their IP and want to attack their computer directly. Either way, it makes things hard if you want to connect to your home network.
We fix this with one of many services that fall under the category "dynamic DNS". In short your computer (or router) tells a third party service what your current internet IP is and they store it as a DNS entry. You end up with a domain name that you can connect to your home network through.
DynDNS is probably the biggest but there are hundreds of companies providing very similar sets of services for free. The good ones have Linux clients available. But check your router as lots come with clients built in and that could save you some time.
I won't mention this again but it's an essential thing to do.
Step two: SSH
Rather than connecting directly to a VNC (or other) server, I strongly suggest you install a SSH server and connect to your desktop over SSH and tunnel the VNC port back to your computer. Sounds like a pain in the bottom and.. Well.. It is. But it provides you strong authentication and should keep bad people out. VNC has in the past had quite a few security issues so it's best (IMO) not to give people direct access to it.
Installing the server is pretty simple:
sudo apt-get install openssh-server
However, I would move it to a non-standard port (mine are all in the 4xxxx range). This helps stop people detecting it by port scanning and therefore helps stop people try and brute force their way in. You can read more about ports here:
Additionally, you can login over SSH via a key. This is much stronger than password authentication but it requires you have your keyfile with you all the time. Pretty trivial if you're used to taking a USB key around with you or you're happy leaving your key on the Windows computer.
We'll stick with password auth for now.
One more thing, we need to make it so people outside the network can access the SSH server. This part is called port-forwarding. Simple but it varies from router to router. You should be able to find a guide here if you need one: http://portforward.com/
Step three: VNC
I hate VNC but it serves a purpose. It's slow, falls over all the time but it's by far the most simple way to connect to your computer.
Rather than installing a SSH server that runs all the time, I use
Step four: Putty
You need something to connect to SSH from Windows. Putty is that application. Getting and installing the app is simple enough (there are even portable versions if you just want to carry it around on a USB stick).
We need to tell Putty to make the remote VNC server available over SSH. This is known as tunnelling. Fortunately it's dead simple. It's graphical so look here for a screenshot guide: http://oldsite.precedence.co.uk/nc/putty.html (Just use port 5900 instead of whatever port they're using!)
At this point you should be able to connect to your server over SSH. Test it out. When you're logged in, run
x11vnc, it'll detect the display and eventually say something along the lines of "awaiting connections".
At this point you can run your VNC client (sorry, having not used Windows properly for years, I've no idea what the best client is). When it asks, connect to
5900 (should be default).
Bish bash bosh. You should have full control of your home desktop.
You can streamline this with various run-on-connect commands. I'm no Putty expert so I'll leave this to you.