pjc123 wrote:
So, a long time ago I set up my Windows PC to connect to my pi using tightvnc through a SSH tunnel. Works great.
So today I tried to vnc from one pi to another pi using the exact same technique, but it displays the local screen, not the remote one. I don't know why this is happening.
So here is the basic setup whether going from Windows to the pi, or from one pi to another. First I start the tightvncserver on the remote pi in an init.d script at boot. Here is the pertinent line in that script:
su pi -c '/usr/bin/tightvncserver -localhost :1 -geometry 1920x1000 -depth 24'
Then on the local pi I set up a tunnel either using putty or from the command line. This works fine and I can verify the encryption with Wireshark. The command line command is:
ssh pi@<ip of remote host> -L 5901:localhost:5901
Then on the local pi I open up a viewer:
xtightvncviewer 127.0.0.1:1
From Windows to the pi this brings up the remote pi's screen as I would expect. But if I do this from one pi to the other it displays the local screen, not the remote screen.
Hi pjc,
Things work fine for me when I do it this way:
Using PuTTY to ssh in with port forwarding of port 5901, on the netbook log on to Pi #1 and start the vnc server:
Code: Select all
pi@raspiblack ~ $ /usr/bin/tightvncserver -localhost :1
New 'X' desktop is raspiblack:1
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspiblack:1.log
NB: I don't usually "auto-start" the server at boot time.
On the netbook:
Code: Select all
trevor@BlueElf:~$ /usr/bin/xtightvncviewer 127.0.0.1:1
Connected to RFB server, using protocol version 3.8
Enabling TightVNC protocol extensions
Performing standard VNC authentication
Password:
Authentication successful
Desktop name "pi's X desktop (raspiblack:1)"
VNC server default format:
32 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using default colormap which is TrueColor. Pixel format:
32 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using shared memory PutImage
Same machine: preferring raw encoding
ShmCleanup called
and all's as expected.
Now, before trying via another Pi, kill off the running server thus:
Code: Select all
pi@raspiblack ~ $ /usr/bin/tightvncserver -kill :1
Killing Xtightvnc process ID 2108
Now (after switching from VGA to HDMI mode on the monitor - I've only one

) boot up Pi #2, startx and then log in to Pi #1 via PuTTY etc. as before. Re-start the vnc server on Pi #1:
Code: Select all
pi@raspiblack ~ $ /usr/bin/tightvncserver -localhost :1
New 'X' desktop is raspiblack:1
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspiblack:1.log
Now, in a terminal window on Pi #2, start the viewer:
Code: Select all
pi@raspiblue ~ $ /usr/bin/xtightvncviewer 127.0.0.1:1
Connected to RFB server, using protocol version 3.8
Enabling TightVNC protocol extensions
Performing standard VNC authentication
Password:
Authentication successful
Desktop name "pi's X desktop (raspiblack:1)"
VNC server default format:
32 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Warning: Cannot convert string "-*-helvetica-bold-r-*-*-16-*-*-*-*-*-*-*" to type FontStruct
Using default colormap which is TrueColor. Pixel format:
16 bits per pixel.
Least significant byte first in each pixel.
True colour: max red 31 green 63 blue 31, shift red 11 green 5 blue 0
Same machine: preferring raw encoding
Again everything worked O.K.
The main things I do differently is NOT starting the server on boot-up and killing the original server before changing m/c's. The latter is not essential since one could just start a new server using "screen" :2 and port 5902 instead.
HTH, Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm