Warning: include_once(/home/winit/hackedpotatoes.com/wp-content/plugins/wordsocial/wordsocial.php): failed to open stream: Permission denied in /home/winit/hackedpotatoes.com/wp-settings.php on line 303

Warning: include_once(): Failed opening '/home/winit/hackedpotatoes.com/wp-content/plugins/wordsocial/wordsocial.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/winit/hackedpotatoes.com/wp-settings.php on line 303

Warning: Cannot modify header information - headers already sent by (output started at /home/winit/hackedpotatoes.com/wp-settings.php:303) in /home/winit/hackedpotatoes.com/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 60
Remote VNC Access «

Remote VNC Access

VNC Access to Raspberry Pi


There's nothing quite like being 500 miles from home and having the ability to control your home computer with your cell phone. In the past, I have used PocketCloud in conjunction with the built in RDP server to access my Windows 7 computer.  It was pretty handy for managing my media library from work or my laptop.

I ran into a problem, though, once I completely moved my home computers to Linux: the best RDP server solution for Linux (xRDP) just didn't cut it. It was nowhere near as seamless as the built in utilities for Windows, and I don't like fiddling past initial setup.

I decided my Raspberry Pi would make a great remote access point. No sensitive information, very low power draw for 24/7 uptime, and I can tuck it in next to my router so I never have to see it.

Join me after the break for a quick and easy tutorial for enabling remote access to your own Linux machine! We'll be using TightVNC Server for Linux, a Raspberry Pi running Raspbian, and your choice of a VNC client.

Setting up VNC access is pretty simple:

  • Install VNC server
  • Forward ports
  • ???
  • Profit!

For this tutorial, I'm going to assume you have a computer running a Debian Linux variant and a static IP setup. It's also helpful to have a DNS hostname pointed at your home network IP address. I recommend DynDNS.org for their free and easy to setup basic DNS services.

The installation is easy; I'd recommend either having SSH setup for headless devices, or using a display if you've got one handy. Log in to the computer you plan on using as your VNC server. Open a terminal, and enter this command:

sudo apt-get install tightvncserver

Once TightVNC finishes installing, go ahead and start up the daemon:


It'll ask you to setup a password, go ahead and enter one twice. You'll be presented with an option to set a read only password. I'd ignore that, as read only access is fairly useless for our purposes. See how easy that was? Now you can access your computer via VNC! Go ahead - fire up a VNC client and connect to (substitute your VNC server's IP address)



To install TightVNC Viewer on Linux, just open a terminal and type:

sudo apt-get install xtightvncviewer

Once it installs, you can test your VNC connection:


Substitute your VNC server's IP address, and you should be prompted for a password! The :1 indicates you are connecting to virtual desktop "1".

Great, so you've got VNC access from another computer, but that doesn't help you get in from a computer outside your home network. You'll need to forward the network ports from your router to the computer.

I'll be using a Linksys router with DD-WRT installed, but you can look up instructions specific to your router. The important thing is to forward the correct port to the correct IP address.

For DD-WRT routers, login to, or whatever your router's IP address is. Navigate to "NAT/QoS" and choose the "Port Forwarding" tab. Add an entry as follows:

Screenshot from 2013-05-18 15:18:44

Let's break it down. The first field is a name for the connection to easily distinguish it. The second is the remote port. Choose "both" for TCP/UDP and substitute your VNC server's local IP address in the fourth field. Enter 5901 for the local port, and finally, you'll enable the Port Forwarding entry.

Forwarding port 5901 to your VNC server allow it to respond to any outside connections on port 5901, effectively giving you remote access.

Edit: FuelCell250 mentioned that it's possible to have bots try the standard port and attempt to brute force the password. If this concerns you, try setting the external port to another number. Make sure you're not using a reserved or other common port number, then adjust the settings in your remote client as required.

We have one more item to handle: Automatically starting VNCServer at boot.

From your terminal, enter this command to create the "init" file:

Screenshot from 2013-05-18 15:20:24

sudo nano /etc/init.d/tightvnc

Now, copy and paste the following into your new file:

# Provides: tightvncserver
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start vnc server
# Description:

case “$1″ in
su pi -c ‘vncserver :1 -geometry 1600×900 -depth 16 -pixelformat rgb565:’echo “VNC Started”
pkill Xtightvnc
echo “VNC Terminated”
echo “Usage: /etc/init.d/tightvnc {start|stop}”
exit 1

Replace "pi" with the username for the account you wish to access remotely, and adjust the resolution to your preferred size. Now hit "CTRL+W" to write the file, then "CTRL+X" to exit nano.

Adjust permissions on the file and make it start automatically:

sudo chmod 755 /etc/init.d/tightvnc

sudo update-rc.d tightvnc defaults

Reboot your VNC server, and try connecting! You should now be able to automatically connect to your computer from any VNC client, whether on your home network or 500 miles away on a 3G connection. As I mentioned before, make sure to setup a hostname to point to your network; this will make it much easier to remotely login to your computer. When outside your home network, you'll need to enter your hostname or external IP address, connecting on port 5901.

Great thanks to the HowToGeek for the init script!



Screenshot from 2013-05-18 15:06:53