Monday, June 20, 2011

VNC Server set up in UBUNTU

[1] http://theseekersquill.wordpress.com/2010/03/16/vnc-server-ubuntu-windows/ ---Best Link
[2] http://nuclear-imaging.info/site_content/2010/04/19/vnc-server-setup-for-ubuntu-10-04-lucid-lynx/
[3] http://usingnix.wordpress.com/2010/12/15/setup-vnc-in-ubuntu-10-10/
[4] http://blog.sudobits.com/2011/03/13/vnc-server-for-ubuntu-10-10/
[5] http://ubuntuforums.org/showthread.php?t=1313898 ---- Get rid of warning for auto start
[6] http://www.debianhelp.co.uk/vnc.htm
[7] http://askubuntu.com/questions/390113/x11vnc-much-slower-than-xvnc-how-to-get-a-xubuntu-session-manually
[8] https://freevps.us/thread-14110.html
[9] https://help.ubuntu.com/community/VNC/Servers
[10] https://wiki.archlinux.org/index.php/TigerVNC  
[11] http://askubuntu.com/questions/603169/lubuntu-14-04-tightvnc-remote-mouse-cursor-is-x

[12] vnc/xrdp to xfce4  windows manager good posts
[13] Using ubuntu 14.04.3 default vino desktop sharing (current session)
[14] One bug fix in early 14.04 vino

qyang@lubuntu-laptop:~$ apt-cache search autocutsel
autocutsel - Keep the X clipboard and the cutbuffer in sync

Got tightvnc work on lubuntu after changing xstartup file
./vnc/xstartup file is configured as follows [11] :


#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey -cursor_name left_ptr
autocutsel -fork
lxsession -s Lubuntu -e LXDE
 

x11vnc is slower. [7] [8] tightvncserver is suggested and faster. [8] vnc4server was discussed a lot.

x11vnc is different from xvnc(tightvnc, tigervnc). The latter support multiple sessions. Also, seems x11vnc is slower than xvnc.[7]
x11vnc offers better security focus ( can be secured with SSH or SSL.) but it's known to be slower. [8]


vino and x11vnc in Ubuntu [9]


VNC SET UP AND SSH SERVER SET UP
-----------------------------------

INSTALL OPENSSH SERVER AND VNC SERVER
----------------------------------------
quentin@QuentinUbuntu:~$ sudo apt-get install openssh-server openssh-client vnc4server xinetd vncviewer
[sudo] password for quentin:
Sorry, try again.
[sudo] password for quentin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'xtightvncviewer' instead of 'vncviewer'
The following extra packages will be installed:
xbase-clients xtightvncviewer
Suggested packages:
libpam-ssh keychain openssh-blacklist openssh-blacklist-extra rssh
molly-guard vnc-java tightvncserver
The following NEW packages will be installed:
openssh-server vnc4server xbase-clients xinetd xtightvncviewer
The following packages will be upgraded:
openssh-client
1 upgraded, 5 newly installed, 0 to remove and 328 not upgraded.
Need to get 3,305kB of archives.
After this operation, 6,484kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
....................
.............


SSH SERVER SET UP
--------------------------------------------
quentin@QuentinUbuntu:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/quentin/.ssh/id_rsa):
Created directory '/home/quentin/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/quentin/.ssh/id_rsa.
Your public key has been saved in /home/quentin/.ssh/id_rsa.pub.
The key fingerprint is:
9f:71:93:c0:80:9f:aa:e5:a9:ec:e1:0c:d2:9a:a3:13 quentin@QuentinUbuntu
The key's randomart image is:
+--[ RSA 2048]----+
| .. |
| . o |
| . .o |
| o . . |
| .S . + |
|E. o . + . |
|..o .+ . o |
|o+ =..o |
|=o .*. |
+-----------------+

SET UP VNC SERVER PASSWORD
--------------------------------------
qyang@lubuntu-laptop:~$ vncpasswd
Using password file /home/qyang/.vnc/passwd
VNC directory /home/qyang/.vnc does not exist, creating.
Password:
Verify: 
Would you like to enter a view-only password (y/n)? y
Password:
Verify: 



START VNC SERVER
-----------------------------
quentin@QuentinUbuntu:~$ vnc4server

New 'QuentinUbuntu:1 (quentin)' desktop is QuentinUbuntu:1

Creating default startup script /home/quentin/.vnc/xstartup
Starting applications specified in /home/quentin/.vnc/xstartup
Log file is /home/quentin/.vnc/QuentinUbuntu:1.log


quentin@QuentinUbuntu:~$ ps aux |grep vnc
quentin 1898 0.1 0.3 10504 5284 pts/0 S 19:07 0:00 Xvnc4 :1 -desktop QuentinUbuntu:1 (quentin) -auth /var/run/gdm/auth-for-quentin-5eao3N/database -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/quentin/.vnc/passwd -rfbport 5901 -pn -fp /usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/Speedo/,/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/75dpi/,/usr/X11R6/lib/X11/fonts/100dpi/,/usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb
quentin 1904 0.0 0.0 4596 1540 pts/0 S 19:07 0:00 vncconfig -iconic
quentin 1936 0.0 0.0 4008 748 pts/0 S+ 19:09 0:00 grep --color=auto vnc

KILL VNCSERVER
------------------------
quentin@QuentinUbuntu:~$ vncserver -kill :1
Killing Xvnc4 process ID 3561

LOCAL VNC ACCESS
-----------------------
quentin@QuentinUbuntu:~$vncviewer localhost:1

SSH SERVER LOG IN VIA PUTTY
-------------------------------
quentin@10.1.1.5's password:
Linux QuentinUbuntu 2.6.35-22-generic #33-Ubuntu SMP Sun Sep 19 20:34:50 UTC 2010 i686 GNU/Linux
Ubuntu 10.10

Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/

Your CPU appears to be lacking expected security protections.
Please check your BIOS settings, or for more information, run:
/usr/bin/check-bios-nx --verbose

336 packages can be updated.
157 updates are security updates.

New release 'natty' available.
Run 'do-release-upgrade' to upgrade to it.


The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.


EDIT VNC XSTARTUP FILE TO REMOVE GREY BACKGROUND
------------------------------------------------
quentin@QuentinUbuntu:~$ vi /home/quentin/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
sh /etc/X11/xinit/xinitrc

#[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#x-window-manager &

#gnome-session &
#twm &

START VNC SERVER AGAIN
----------------------------------
quentin@QuentinUbuntu:~$ vncserver
xauth: creating new authority file /home/quentin/.Xauthority

New 'QuentinUbuntu:1 (quentin)' desktop is QuentinUbuntu:1

Starting applications specified in /home/quentin/.vnc/xstartup
Log file is /home/quentin/.vnc/QuentinUbuntu:1.log


MAKE VNC SERVER AUTO RUN WHEN BOOT
------------------------------------
$sudo -i

root@QuentinUbuntu:~# vi /etc/init.d/vncserver

#!/bin/sh -e

### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: networking
# Default-Start: S
# Default-Stop: 0 6
### END INIT INFO

PATH="$PATH:/usr/X11R6/bin/"

# The Username:Group that will run VNC
export USER="quentin"
#${RUNAS}

# The display that VNC will use
DISPLAY="1"
# Color depth (between 8 and 32)
DEPTH="16"
# The Desktop geometry to use.
#GEOMETRY="x"
#GEOMETRY="800x600"
GEOMETRY="1024x768"
#GEOMETRY="1280x1024"
# The name that the VNC Desktop will have.
NAME="QuentinUbuntu-vnc-server"
OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
. /lib/lsb/init-functions

case "$1" in
start)
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;
stop)
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;
restart)
$0 stop
$0 start
;;
esac
exit 0

root@QuentinUbuntu:~# chmod +x /etc/init.d/vncserver

MAKE IT AUTO RUN WHEN BOOT
-----------------------------------
sudo update-rc.d vncserver defaults
update-rc.d: warning: /etc/init.d/vncserver missing LSB keyword 'required-stop'

update-rc.d: warning: vncserver start runlevel arguments (2 3 4 5) do not match LSB Default-Start values (S)
update-rc.d: warning: vncserver stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (0 6)
Adding system startup for /etc/init.d/vncserver ...
/etc/rc0.d/K20vncserver -> ../init.d/vncserver
/etc/rc1.d/K20vncserver -> ../init.d/vncserver
/etc/rc6.d/K20vncserver -> ../init.d/vncserver
/etc/rc2.d/S20vncserver -> ../init.d/vncserver
/etc/rc3.d/S20vncserver -> ../init.d/vncserver
/etc/rc4.d/S20vncserver -> ../init.d/vncserver
/etc/rc5.d/S20vncserver -> ../init.d/vncserver
To get rid of warning

we change the /etc/init.d/vncserver

### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO

quentin@QuentinUbuntu:~$ sudo update-rc.d -f vncserver remove
Removing any system startup links for /etc/init.d/vncserver ...
/etc/rc0.d/K20vncserver
/etc/rc1.d/K20vncserver
/etc/rc2.d/S20vncserver
/etc/rc3.d/S20vncserver
/etc/rc4.d/S20vncserver
/etc/rc5.d/S20vncserver
/etc/rc6.d/K20vncserver

NO MORE WARNINGS
--------------------------------
quentin@QuentinUbuntu:~$ sudo update-rc.d vncserver defaults
Adding system startup for /etc/init.d/vncserver ...
/etc/rc0.d/K20vncserver -> ../init.d/vncserver
/etc/rc1.d/K20vncserver -> ../init.d/vncserver
/etc/rc6.d/K20vncserver -> ../init.d/vncserver
/etc/rc2.d/S20vncserver -> ../init.d/vncserver
/etc/rc3.d/S20vncserver -> ../init.d/vncserver
/etc/rc4.d/S20vncserver -> ../init.d/vncserver
/etc/rc5.d/S20vncserver -> ../init.d/vncserver

No comments: