Saturday, 22 June 2013

VNC server and viewer setting up notes

*** Starting X at RPi ***

I entered command "startx" at SSH PuTTY terminal and found that the X started is Version 11, Revision 0.  The RPi operating system is Linux raspberrypi 3.6.11


*** Install tightVNC ***

Then I installed tightVNC.

$ sudo apt-get update
$ sudo apt-get install tightvncserver


*** tightvnc password setting ***

Then I set password to "raspberry".

$ vncpasswd


*** Start vncserver ***

And I ran tightvnc server.

$ vncserver :1

[$ vncserver :1 -geometry 1024x728 -depth 24]

pi@raspberrypi ~ $ vncserver :1
New 'X' desktop is raspberrypi:1
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:1.log


*** Checking RPi IP address ***

pi@raspberrypi ~ $ ip addr show

    ...

    inet 192.168.1.40/24 brd 192.168.1.255 scope global wlan0

    inet 192.168.1.56/24 brd 192.168.1.255 scope global secondary wlan0


*** Using SSH PutTTY to solve the "cannot open display" problem ***

I tired a couple of commands advised by the experts as listed below.

$ echo $DISPLAY
$ export DISPLAY='IP:0.0'
$ xhost +
$ echo $DISPLAY:192.168.0

They don't seem to work, perhaps because they are not particularly for RPi.  Anyway, even they work, there is still a big problem with playing with OpenCV with SSH PuTTY, that is I cannot use the mouse.

So I decided to go back and use tightVNC and Ultra VNC Viewer.


.END

*** raw data ***

*** startx to start X session ***

pi@raspberrypi ~ $ startx

X.Org X Server 1.12.4
Release Date: 2012-08-27
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.2.0-2-mx5 armv7l Debian
Current Operating System: Linux raspberrypi 3.6.11+ #464 PREEMPT Thu Jun 6 18:17:55 BST 2013 armv6l
Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=1024 bcm2708.boardrev=0xe bcm2708.serial=0x89c7d61d smsc95xx.macaddr=B8:27:EB:C7:D6:1D sdhci-bcm2708.emmc_clock_freq=100000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Build Date: 20 April 2013  05:19:09AM
xorg-server 2:1.12.4-6 (Julien Cristau <jcristau@debian.org>)
Current version of pixman: 0.29.3
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.

(==) Log file: "/var/log/Xorg.0.log", Time: Sat Jun 22 02:13:16 2013

(==) Using system config directory "/usr/share/X11/xorg.conf.d"


*** Ctrol-C to end X session ***

^C xinit: connection to X server lost

waiting for X server to shut down Server terminated successfully (0). Closing log file.

xinit: unexpected signal 2

*** Install tightVNC ***

Enter the following command into SSH PuTTY terminal:

$ sudo apt-get update
$ sudo apt-get install tightvncserver

*** Start vncserver ***

$ vncserver :1

pi@raspberrypi ~ $ vncserver :1
New 'X' desktop is raspberrypi:1
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:1.log


*** Setting VNC server password ***

vncpasswd(1) - Linux man page

Name

vncpasswd - change the VNC password

Synopsis

vncpasswd [passwd-file]
vncpasswd -f

Description

vncpasswd allows you to set the password used to access VNC desktops. Its default behavior is to prompt for a VNC password and then store an obfuscated version of this password to passwd-file (or to $HOME/.vnc/passwd if no password file is specified.) 

The vncserver script runs vncpasswd the first time you start a VNC desktop, and it invokes Xvnc with the appropriate -rfbauth option. vncviewer can also be given a password file to use via the -passwd option.

The password must be at least six characters long (unless the -f command-line option is used-- see below), and only the first eight characters are significant. Note that the stored password is not encrypted securely - anyone who has access to this file can trivially find out the plain-text password, so vncpasswd always sets appropriate permissions (read and write only by the owner.) However, when accessing a VNC desktop, a challenge-response mechanism is used over the wire making it hard for anyone to crack the password simply by snooping on the network.

*** vnc password setting **

vnc password = raspberry [truncated to 8 characters]

remote host = 192.168.1.40

Port = 5900

*** vnc server running ***

vncserver :1 -geometry 1024x728 -depth 24

pi@raspberrypi ~ $ ip addr show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo

2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether b8:27:eb:c7:d6:1d brd ff:ff:ff:ff:ff:ff

3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether cc:5d:4e:2e:0f:63 brd ff:ff:ff:ff:ff:ff

    inet 192.168.1.40/24 brd 192.168.1.255 scope global wlan0

    inet 192.168.1.56/24 brd 192.168.1.255 scope global secondary wlan0

$ echo $DISPLAY

$ export DISPLAY='IP:0.0'

cc@amd8:~$ echo $DISPLAY:192.168.0

But if I ssh -Y into my Ubuntu 11.04 machine, gedit .bashrc works. 

echo $DISPLAY returns "localhost:10.0".


X11Forwarding yes

$ xhost +
access control disabled, clients can connect from any host

Enable X11 forwarding

While doing ssh use the option -X to enable X11 forwarding.

$ ssh username@hostname -X
Enable trusted X11 forwarding, by using the -Y option,

$ ssh username@hostname -Y

$ export DISPLAY='IP:0.0'

.END

No comments:

Post a Comment