Skip to main content
Engineering LibreTexts

Setup pitunnel for VNC access

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Why the pitunnel through VNC? A collaborative workspace enhances learning.  

    Aim of this chapter:    setup VNC access through the pitunnel so that other class participants can login and use a graphical IDE or command-line editor.

    Register for the free or paid version of pitunnel.

    Setup a pitunnel for VNC access to your RPi.

    From the “Installation” link in pitunnel you should see a curl command and ends with the ‘&’ character.

    Next you will have your RPi initiate at tunnel through the firewall.

    Go to custom tunnel as shown below.



    The button above labeled “Create Custom Tunnel” sends the user to a new window for creating the custom tunnel using the command-line.

    See note below;



    Port 5900 is used for VNC.

    For tunnel name use VNCtunnel.

    pitunnel --port=5900 --name=VNCtunnel

    Paste and run the command similar to the above that was produced for your RPi to initiate the tunnel through the firewall.



    Pressing Ctrl-C will stop this tunnel and return the command prompt.  If you wanted to keep it running but still need a command prompt then just open another terminal.

    Alternatively start the tunnel in the background using the following advanced Linux technique.



    Note: To get the command prompt back press enter twice.



    Under Custom Tunnels pick up the IP:port used for the VNC.

    In this example,

    Within the VNC client use the IP:port that you got from the pitunnel.



    Next, for temporarily sharing your pitunnel-VNC-desktop with collaborators change your password to binf.123 (or similar).

    Share the IP:port

    Share the password     binf.123

    Share through email or chat window.


    After the collaboration is completed reset the password and turn off the pitunnel.

    If pitunnel is running in the foreground of the terminal then use Ctrl-C.  if it was started in the background you can reboot to turn off the pitunnel.

    What if you started pitunnel in the background but you do not want to reboot to turn off the pitunnel?

    Ask the instructor how to find and stop a running process in Linux.



    Setup pitunnel for VNC access is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?