Raspberry - SSH VNC

  • In Raspbian Jessie ssh may already be enabled by default but if not open a terminal and type:
    sudo raspi-config
  • select 7 Advanced Options
  • select A4 SSH
  • You’ll be asked if you want enable SSH Select Yes.
  • To find the IP address of you pi open a terminal and type:
    hostname -I
  • On another computer open terminal(Linux) or command line in Windows, I’m using Ubuntu and type;
    ssh [email protected]<YOUR Raspberry Pi IP ADDRESS>
  • It will prompt you for your password. NOTE: the default password for the user pi is raspberry, you can now change this.
  • Now install VNC Server on the Raspberry pi open Terminal, and type:
    sudo apt-get install tightvncserver
  • To start VNC Server, type:
  • You’ll be asked to set a password to access the pi. You’ll need this when you try to access the pi from another computer.
  • To run VNCServer at Startup
  • You will normally want the VNC Server to run automatically after the Raspberry Pi reboots, open a terminal and type:
    cd /home/pi
    cd .config
    mkdir autostart
    cd autostart
  • Create a new autostart file for TightVNC by typing the following:
    sudo leafpad tightvnc.desktop
  • This will open the default text editor (leafpad) with a blank file called tightvnc.desktop Edit the contents of the file with the following text:
    [Desktop Entry]
    Exec=vncserver :1
  • Connecting to Raspberry Pi via VNC
  • On another PC open Remina (or other VNC Client)
    server address is IP-Address-of-Your-pi:1 (note :1 which defines display 1)
  • Username is pi
  • Password is: whatever you set for Tightvnc

  • You should now have a VNC connection to your pi.
  • This is all fine if you want to run the pi headless and administer it remotely but, if like me you want to run a pi with a monitor attached as a display sign for example then you will need to be able to display the same monitor output on both HDMI and VNC. Remember from above the pi was displaying session :0 and VNC displayed session :1
  • To achieve this I used X11VNC rather than TightVNC

  • Install X11VNC open a Terminal and type:
    sudo apt-get install x11vnc
    x11vnc -storepasswd
  • As with TighVNC before we need to set X11VNC to autostart in a terminal type:
    cd /home/pi
    cd .config
    mkdir autostart [You can miss this step if you’ve already created the directory]
    cd autostart
    sudo leafpad x11vnc.desktop
  • Type the following text into the x11vnc.desktop file:
    [Desktop Entry]
    Exec=x11vnc -forever -usepw -display :0 -ultrafilexfer

    Note: If you created an autostart file for TightVNC as above, then remember to either remove this file from the autostart directory or delete it, otherwise when you reboot your pi it will try and start both TightVNC and X11VNC. You should now be able to connect to your Raspberry pi using your VNC client with the IP address of your pi (without the :1) and it should display the same output as the Rasperry pi HDMI monitor.