Raspberry Pi: Setting up remote access via TightVNC Server

Install the server on the pi:

sudo apt-get install tightvncserver

Now set up the server to start tightvncserver at boot:

Paste the following into /etc/init.d/tightvnc. You will want to configure the line starting with /usr/bin/tightvncserver. The Pi can do 1920×1080 so that would be the max resolution.

# First configure the user you want to run this under - this will generally be pi, unless you've created your own users
export USER='pi'

eval cd ~$USER

# Check the state of the command - this'll either be start or stop
case "$1" in
  start)
    # if it's start, then start vncserver using the details below
    su $USER -c '/usr/bin/vncserver :1 -geometry 1366x768 -depth 24 -pixelformat rgb565'
    echo "Starting vncserver for $USER "
    ;;
  stop)
    # if it's stop, then just kill the process
    pkill Xtightvnc
    echo "vncserver stopped"
    ;;
  *)
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0

Then:

sudo chmod +x /etc/init.d/tightvncserver

Now add the script at startup via update-rc.d:

sudo update-rc.d tightvncserver defaults

Now you can access the remote desktop using Ubuntu’s Remote Desktop Viewer tool by entering the Pi’s IP followed by  :1. For example “192.168.0.1:1”

Windows has a variety of clients that can be used too.

For more info see http://elinux.org/RPi_VNC_Server

By Sam

Drupal developer from Perth, Western Australia. I love programming, gaming, the Internet, growing vegetables and hiking.

Leave a comment

Your email address will not be published. Required fields are marked *