Wall's Corners Wall's Corners Author
Title: Remotely access your Raspberry Pi part 1: VNC
Author: Wall's Corners
Rating 5 of 5 Des:
If you do not have a monitor attached to your Pi permanently there are several ways to remotely access it. One of the most straightforward i...

If you do not have a monitor attached to your Pi permanently there are several ways to remotely access it. One of the most straightforward is VNC (Virtual Network Computing). In straightforward terms VNC displays the desktop of your Pi on another computer that you own.

To use VNC you will first need to configure your , and then from your other computer run a VNC client and connect back to the Pi. For the client, try RealVNCwhich is available for Windows, Mac OS X, Linux and Solaris.

First, configure your Pi (configuration will require you to either have a monitor attached or to be connecting from the terminal via ssh):

1) At the terminal run the following commands to install vncserver:

sudo apt-get update
sudo apt-get install vnc-server
vncserver -geometry 1024×768

The first command will ensure that your Raspberry Pi will run any installation commands against the latest available list of packages, ie: it will install the latest version of any program available in the repositories.

The second command installs vncserver. Note that installation is “vnc-server” with the hyphen.

The third command starts the VNC server (this time note the command omits the hyphen) and sets the geometry parameter to indicate that when a connection is made a window containing the Pi’s desktop that is 1024×768 pixels should be sent to the client computer. Change this value to change the screen size of your Pi’s desktop when accessed remotely.

Note that the first time you start vncserver you will be prompted for a password to remotely connect to your Pi with (this should not be the same as the password you use to normally log into your Pi with!) Ensure that you enter a unique secure password. You will also be asked to enter an optional password for read only access – you can skip this second password request for now.

Assuming that vncserver starts successfully you should see something like:

pi@rpi3 ~ $ vncserver -geometry 1024×768

New ‘X’ desktop is rpi3:1

Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/rpi3:1.log

Note the “rpi3:1” bit. rpi3 is the name of my Raspberry Pi and 1 is the number of the desktop you will be connecting to. We will need this 1 later.

2) On your client computer install the RealVNC Viewer application from the downloads page. Note you should install the Viewer from this page, not the full RealVNC package as you want to connect to your Pi.

3) Back on your Pi run ifconfig at the command prompt in the terminal to determine your IP address. Look for the eth0 entry (assuming your Pi is using a wired network connection and not WiFi (else look for the wlan0 section):

eth0 Link encap:Ethernet HWaddr ****
inet addr:192.168.1.75 Bcast:192.168.1.255 Mask:255.255.255.0

The important information you will need is the IP address, which in my case is 192.168.1.75 (yours will vary). This is the address we will connect to from RealVNC Viewer.

4) Back on your client computer (I’m using an Apple Mac for this example, but these instructions will work on Windows as well). Run VNC Viewer and enter the IP address of your Pi followed by :1 (the 1 we got at the end of step 1).

vnc1

5) Click Connect. Immediately you will see a warning message. This is important – the connection you are creating is not encrypted, which means that if you type sensitive information into your Pi via this method (eg: passwords) then it can potentially be intercepted by a third party. This includes the password used to access your Raspberry Pi via VNC (hence choosing a different password to your normal login password when starting vncserver for the first time). You should not use this unencrypted method to access your Pi from other internet as a result! And you should exercise care when using this method on your own local network.

vnc2

6) Assuming we accept the risk click [Continue].

7) You will be prompted for the password you entered to access VNC earlier.

vnc3

8) Click OK after entering your password. You will see a message stating that RealVNC Viewer is connecting to your Pi. After a few seconds you should see your Pi’s desktop on your own. You can now run programs on your Raspberry Pi from your client computer directly.

vnc4

9) Note that if you reboot your Pi you will need to restart vncserver. vncserver can be set to run after a reboot, but given the unencrypted connection being used it is suggested that you do not run it in this form unless needed. Encrypting your VNC connection is beyond the scope of this introductory tutorial but will be covered in the future. However if you plan on taking your Raspberry Pi to an event and want to have vncserver start automatically then those great people at Adafruit have straightforward instructions for you to follow ready written:

http://ift.tt/11afbFp

Note that for this step to work you will also need to ensure that your Raspberry Pi boot straight into the Desktop. Fortunately Adafruit have this covered too.

http://ift.tt/1UIqRyB

Share This:

View more at: http://yoursmart.mobi

About Author

Advertisement

Post a Comment

 
Top