Ok, first off, every solution needs a problem. Mine was VNCing to my dorm computer from home. I couldn't just connect to my server, as all computers on campus are isolated from the internet with a proxy. All connections have to be routed through the proxy. Now, I've found various ways of outsmarting the filtering programs built into the proxy and allowing me to use almost any TCP application over the proxy even if it doesn't support it, although gaming still remains impossible, apart from simple TCP things.
So, the only way I'm going to get connections is to establish an outgoing connection from campus to home. This is easy enough. And for my techniques to work, it will have to be easy enough for you as well.
The general idea is we are going to do a reverse VNC connection. The client, for me it's on my home computer, listens for a connection. The server, on my college computer, connects to the client, and we have a connection as desired. Now, the only problem remains in how to trigger the college computer to make this connection.
The first thing is, the computer at campus has to be on. If it is off, this will severly limit it's use, unless you only live 10 minutes away, and not 6 hours like I do.
First of all, plan to leave your computer on when you leave. Simple enough. Next, we have to plan for power surges and power outages if possible. My BIOS has a setting for just that. I have it set to resume whatever state it was after a power outage. So if the power goes out, when it comes back on the computer reboots.
Next step is to turn autologon with TweakUI (you can turn the screensaver password on as a coutermeasure just incase, if you wish). The desired result is for an unattended boot to land the computer at the desktop. This step is optional, as services don't need a desktop to run, but then you'd need a service to trigger VNC server to connect. I use a desktop program, so this isn't an option for me.
Then, to prevent your RA or RD doing room inspections from turning off the computer and ruining all your plans, remember to put a couple sticky notes on your computer. Unplugging and hiding the mouse and keyboard should also theoretically work to enforce the sticky notes' demands to leave the computer alone.
Now we have a computer that will boot. Next we need a startup program that can trigger VNC Server when we need it triggered. Remember, no incoming connections, so we need something that will connect to a server outside of the firewall or proxy, that we can also connect to from home. Then we can send a message to the computer. I use mIRC, my favorite IRC client, which is well suited for this as it is extremely scriptable. But if you want to get creative, and you can program, you can make a program to check an e-mail inbox or something.
Next we need to decide on security for whatever script or whatnot we are going to write. I can't help with the actual script, but what we need to do is build in authentication, so not any random Joe can connect to your computer and start deleting files left and right. Another option is to hard code the IP that the server will connect to, but then if your IP changes you're screwed. My script compares a sent password with a hardcoded one and then connects to the IP and port of my specification.
Once you've coded the authentication part, you then need to put the command in to run the server:
winvnc.exe -connect (IP[::PORT])
::PORT is optional, and will default to the default VNC listen port if not specified.
Now to test it. For my IRC app, I fire up a second instance of mIRC. Then I run the VNC listen client, and send a message to my other mIRC with the proper password, and localhost as the IP address. Then mIRC executes the following:
winvnc.exe -connect localhost
Then the server connects and I'm looking at my own desktop.
One last note, at home (or wherever), be sure the proper ports are forwarded through your router or firewall so the incoming connection can get through. If you don't know anything about that stuff this site has some useful info. Look up the general purpose stuff and google around for the actual one or two ports you'll need to open.
To summarize:
- Set your server to remain on and boot when power goes out, if possible.
- Set your server to boot to the desktop and autorun the app that provides the authentication interface.
- Set the app to actually connect to the server, autoconnect when connection is lost, or whatever the method you choose to use calls for (IE, email connection might just call for a brief check every 10 minutes, a constant connection makes no sense there).
- Be sure that there is no way for a random user to take control of your server short of figuring out your password. And make THAT as difficult as possible.
- To test, pick a client (localhost is the best first test) and run VNC client in listen mode, and go through the motions to trigger a connection.