Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

VNC on Linux

News See also Recommended Links Recommended Papers VNC over SSH Vino
X11vnc VNC on solaris VNC on Windows krfb Rc-files FreeNX
The vncserver modification .Xdefaults Starting VNC server Xstartup Humor Etc

If you are running the Gnome desktop then you already have a VNC server built in. Click Desktop > Preferences > Remote Desktop to open the dialog, make sure that all four options displayed are clicked, select the password and you are in the game. For gnome users the built-in  Vino (VNC server for Gnome) is more efficient then stand-alone solution.  It is OK for older (non dual-core) PC and laptops too.  Please note that in RHEL 4 and OpenSuse10.2 vino is not installed by default and you need to install the RPM manually to make it work.

The main problem with vino is that it does not support copy/paste with Windows client. In this sense you are better off using X11vnc.

The same Remote Desktop option exists for KDE but krfb, a VNC compatible server for the KDE desktop, which implements this option is slow and very resource hungry.  It is not recommended for older PCs (you might have up to 80% of CPU consumed by krfb).  That means that until version 4.0 KDE did not have a good analog to Vino.  Unless you have dual core CPU and a lot of RAM you should not even try krfb. Here is a typical post about the problem on a small desktop (NDS Engineers Support Forums): 

Hi, I'm running Linux Suse 9.0 like a VM with Vmware ESX 2.1
The kernel version is 2.4.21-246smp4G , the KDE version 3.1.4

Everytime that I connect remotely the krfb process use 100% of the CPU all
the time, check my top statistics, any ideas

thanks

Artiman

________________________________

top - 08:30:45 up 19:48, 3 users, load average: 1.69, 1.52, 0.77
Tasks: 83 total, 4 running, 78 sleeping, 0 stopped, 1 zombie
Cpu(s): 20.7% user, 76.9% system, 0.0% nice, 2.4% idle
Mem: 255072k total, 250764k used, 4308k free, 40168k buffers
Swap: 514040k total, 0k used, 514040k free, 108544k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2761 root 25 0 15712 15m 10m R 43.6 6.2 3:38.77 krfb
911 root 25 0 14784 10m 2420 R 34.4 4.1 42:31.89 X
2757 root 16 0 15712 15m 10m S 16.9 6.2 1:43.51 krfb
2797 root 15 0 17460 17m 14m R 1.0 6.8 0:01.23 kdeinit
1031 root 15 0 15308 14m 13m S 0.3 6.0 0:02.51 kdeinit

Therefore, a better option is to use X11vnc. I've found  X11vnc  to be a very reliable server.

Default desktop sharing on KDE 3.x is available but practically unusable because krfb, a VNC compatible server for the KDE desktop, is very slow and very resource hungry.

To configure desktop sharing you need to click the menu Configure Desktop -> Desktop -> Internet and Network -> Desktop Sharing. After that you can click all four option of unclick "Allow uninvited connected". Then you need to select your password. If you unclick "Allow uninvited connected" you should use long (longer then 8 characters), preferably  AOL-style ("double words") type of password like NNccru-831123 or XlonG-55927 -- "easy" password without a firewall means significant risk of intrusion. See also [PDF] The Desktop Sharing Handbook

By default, VNC is not a secure protocol. While passwords are not sent in plain-text (as in telnet), brute-force cracking could prove successful if both the encryption key and encoded password are sniffed from a network. For this reason it is recommended that a password of at least 8 characters is used. However, VNC may be tunneled over an SSH or VPN connection adding an extra security layer. SSH tunnels can be created from any clients. RealVNC offers high-strength encryption as part of its commercial package.

KDE users can use any lightweight lightweight desktop like Xfce with classic VNC for remote access

Most GNU/Linux users choose GNOME or KDE for desktops without thinking. However, many alternatives exist, ranging from minimalist graphic environments in window managers like IceWM to entire alternative desktops, such as ROX. Of these alternatives the best-known and most polished is Xfce. Now at version 4.4, Xfce resembles a stripped-down version of GNOME, with carefully selected customization options and utilities, as well as a few thoughtful features of its own.

As detailed on the download page, Xfce is available in many distributions. In fact, a growing number of distributions, including Xbuntu, Dream Linux, and Zenwalk use Xfce by default. Alternatively, you can build Xfce from source code, or use its graphical installers. However, if you choose the graphical installers, read the documentation first to make sure you understand what you are doing, and the extra steps that you might have to take if you missed a cue from the installation wizard.

X11vnc provides the view of the view of real X display similar to WinVNC. Starting from version 0.9 it also contains several useful extensions pioneered by UltraVNC.

x11vnc is a program that allows one to remotely view and interact with real X displays (i.e. a display corresponding to a physical monitor, keyboard, and mouse) with any VNC viewer. It is similar to WinVNC and is designed to be compatible with all Unix variants and depend on a very small set of standard libraries. It supports a growing number of command line options, such as -nofb for dual- headed mode with Win2VNC. It is part of the LibVNCServer project.

Release focus: Minor feature enhancements

Changes:
VNC Service advertising via mDNS (also known as ZeroConf or BonJour) is supported by the Avahi library. UltraVNC's TextChat, SingleWindow, and ServerInput extensions are supported (requires the UltraVNC or SSVNC viewer). Short aliases -find, -create, -svc, and -xdmsvc for common usage modes are added (e.g. to find a user's X display or create a new one with Xvfb). Reverse VNC connections (viewer listening) now work in -ssl mode. XDAMAGE use is automatically disabled if it appears to not be working properly (it often does not work with OpenGL applications like Beryl and MythTV).

Author:
Karl Runge [contact developer]

We strongly recommend TightVNC viewer as it includes a number of nice features over the official VNC client.  It can work iether with TightVNC server or with the standard server. An x11vnc project provides an Enhanced TightVNC Viewer package (SSVNC) for Unix, Windows, and Mac OS X with automatic SSL and/or SSH tunnelling support, SSL Certificate creation; and on Unix: NewFBSize, ZRLE, cursor alphablending, and low color modes support. Also on Unix the UltraVNC Text Chat, Single Window, Server Input, and 1/n Scaling extensions are supported. This bundle could be placed on, say, a USB memory stick for SSL/SSH VNC viewing from nearly any networked computer.

The Tight VNC modifications take effect in the client and server, but it’s the client changes that people appreciate most.  The user has three options to connect: best compression, fast compression and listen mode. Best compression uses JPEG compression to give you the fastest connection speed, along with the integrated data compression schemes. Fast compression uses data compression but doesn’t do the JPEG compression. All-in-all fast compression looks good and operates with reasonable speed. Actually if you are on 100Mb network on local LAN it does not matter :-).

All in all VNC is an amazing piece of free software that gets the job done.  Tight VNC makes a great program even better.

The TightVNC viewer is available as a pre-compiled binary or as source code. Only download the source if you are familiar with building packages or have an OS which doesn't have pre-built binaries. 

VNC Client Display Resolution

Depending on your VNC use, you may want to have a larger or smaller display than the default or a different number of colors. This often happens if you want to run the display full-screen or want to save your reduce the information over your network connection by choosing a smaller color set or resolution. The VNC server allows you to choose a resolution and color depth by connecting to different ports. Usually port 5995 is used, which corresponds to a 1024x768 resolution with 16 bit color, however you can choose any port 5991 to 5999.

Choose a resolution (800x600, 1024x768, or 1280x1024) and a color depth (8 bit, 16 bit, or 24 bit) and find the corresponding port in the following table.

Port Resolution Color Depth
5991 800x600 8 bit
5992 800x600 16 bit
5993 800x600 24 bit
5994 1024x768 8 bit
599 1024x768 16 bit
5996 1024x768 24 bit
5997 1280x1024 8 bit
5998 1280x1024 16 bit
5999 1280x1024 24 bit

Checking local display setting

It is useful to know your local display's settings for choosing a VNC display. For instance, to make a full screen display you would match the local display resolution with the VNC display resolution. The resolution for the iMacs defaults to 1024x768 and the Suns in the Asprey lab default to 1280x1024. Here are instructions for finding the local display settings on several popular operating systems.


Notes:
  • This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Some amount of grammar and spelling errors should be expected.
  • The site contain some broken links as it develops like a living tree... Please try to use Google, Open directory, etc. to find a replacement link (see HOWTO search the WEB for details). We would appreciate if you can mail us a correct link.
Google Search
Open directory

Research Index


Old News ;-)

[SOLVED] Re using vino-vncviewer - Ubuntu Forums

SOLVED] Re: using vino/vncviewer

> you can still run a stand-alone vnc server (does not use the current
> desktop). several, in fact. OR you can simply ssh into the box and
> run an X11 application and it will show up on the screen that you are
> currently using if you have an Xserver running there (linux in
> graphical mode, or windows with 3rd party software - ie
> hummingbird($$), cygwin(free) ).
>
> the vnc server route gives you the option of disconnecting and
> reconnecting from the session without the programs terminating
> (somewhat like remote desktop in windows).
>

SuSE has a very nice setup, but as my SuSE box is currently running
Mepis I don't have the recipe.

It runs the server out of xinetd, and you get a standard dm login screen.

Red Hat does it differently, and I have the recipe for something similar
because I've adapted it.

I run a script at boot time along with all the others in /etc/init.d

Here's the script:
summer@Kookaburra:~$ cat /etc/init.d/vnc
#!/bin/bash
# If no config, do nothing
[ -f /etc/vncserver.conf ] || exit 0
function cfg()
{
sed </etc/vncserver.conf \
-e 's=#.*$==g' \
| grep -v '^$'
}


case "$1" in
start)
cfg | while read user port options
do :
echo Starting session for ${user} on ${port}
eval passwdfile=~${user}/.vnc/passwd
if [ ! -f ${passwdfile} ] ; then
echo Cannot start session for ${user}, no passwd file
continue
fi
P=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/g ames
[ "${user}" = "root" ] &&
P=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi n:/sbin:/bin:/usr/bin/X11
su - ${user} -c "PATH=${P} vncserver ${options} ${port}"
done
;;
stop)
cfg | while read user port options
do :
echo Stopping session for ${user} on ${port}
eval passwdfile=~${user}/.vnc/passwd
if [ ! -f ${passwdfile} ] ; then
echo Cannot stop session for ${user}, no passwd file
continue
fi
su - ${user} -c "vncserver -kill ${port}"
done
;;
*)
echo ${0} '[start|stop]'
;;
esac

summer@Kookaburra:~$


Here's the config file:
summer@Kookaburra:~$ cat /etc/vncserver.conf
# vncserver configuration: sessions to start automatically
# User display <options>
root :55 -geometry 1600x1200
suzanne :1 -geometry 1024x850
summer@Kookaburra:~$


1600x1200 us the resolution of the screen I connect from. I run the
client full-screen. Colours can be a bit strange, but otherwise it works
very well.


You can also configure your dm to accept remote clients, then run X thus:
X -query garage.home.lan
I generally do that from inittab.

You switch with the usual ctrl-alt-F7 etc.

Finally, here is a great article that touches on this:
http://www.linuxworld.com/story/32827.htm
Just slip Ubuntu in in place of those other distroes whereever you like.

Setting Up VNC on RHEL 4

Calvin Webster cwebster "at" ec.rr.com
Fri Apr 28 22:47:01 2006

 


I've been meaning to do this for quite some time. I figured this was a
good opportunity to pass on my experience in setting up VNC on our
network. VNC has become one of the most useful tools I've ever used. It
allows me to do the work of several administrators by eliminating most
of the time required to physically touch a remote computer. 

I manage several interconnected LANs and network services spread across
4 buildings. Each building houses one or more offices and training
facilities consisting of various blends of hardware/software platforms,
applications, and users. If your network is anywhere near as diversified
as ours, you'll need to do some research to get VNC running on all your
platforms, but this should get you started using it in the way I think
most people expect.

This collection of notes is very simplified, assuming the reader has
reasonable Linux sysadmin skills and experience. Although the VNC
documentation is comprehensive, some key configuration details seemed to
be missing or hard to find for the setup we needed here. I've tried to
cover them below.

MS Windows installations are pretty straightforward since it's a
single-user OS. Just login as Administrator and run the InstallShield
installer, then configure. I setup all our Windows machines with the
Administrator password. Unfortunately (or fortunately, depending on your
perspective) this means that only the sysadmin can connect to these
machines. However, it also installs the VNC client with which users can
connect to network servers. On our network we have Unix/Linux
development machines to which they connect this way.

Any Unix/Linux machine that you can get GCC on will support VNC. Most
Unix users I talk to expect to get a graphical login when they connect
so I set it up to use the XDM login, just like it would if you were
standing in front of the console.

I'll keep an eye on this thread for a while. If I've left anything out
I'll try to fill in the blanks. One last warning: watch out for wrapped
lines below.

--Cal Webster

## References:

Documentation for VNC Free Edition 4.1:
	http://www.realvnc.com/products/free/4.1/

Other Multi-resolution Examples:
	http://www.realvnc.com/pipermail/vnc-list/2005-March/049889.html

Documentation for RHEL 4:
	https://www.redhat.com/docs/manuals/enterprise/

## Notes:

	32-bit color depths didn't work for me I'm offering only 8, 16, and 24
bit

	"True colour" for 32-bit setting is uneven for rgb and shift settings

	24-bit setting evaluates to "32 bits per pixel" in the "VNC server
default format"

	Native X display (root console :0) uses default resolution of 8-bit
1024x768

## Goals:

	To provide users with a method of connecting to servers with a
graphical user interface from any workstation platform without
saturating network bandwidth or requiring expensive, bandwidth-hungry
3rd party connectivity solutions (like Hummingbird Exceed).

	To provide system/network administrators with a method of remotely
supporting and maintaining server and client computers regardless of
their host platform.

	To provide the means to support on-the-spot training and
troubleshooting during a helpdesk call.

## Security:

	Examples shown below use somewhat relaxed security settings. You may
want to use more paranoid settings if your network is at high risk. For
example, you may choose to restrict VNC server to "localhost"
connections and require clients to tunnel their VNC connections using
SSH. You DEFINITELY want use this method if going over the public
Internet. Bear in mind that this will limit available network bandwidth
due to the encryption overhead inherent in the tunnel. If there is not
enough available bandwidth for a given color depth, VNC will
automatically throttle back to the most appropriate color depth.

	If your network manager allows, and your perimeter and host security
defenses are sufficient, you can take simple precautions without using
SSH tunneling while maintaining a high degree of VNC functionality.

	I highly recommend setting a password for the VNC "Native X Display"
(root console :0) even if you have a secure network. See last item in
examples. All other displays can use the XDM login authentication. The
reason for this is that anyone could take control of a root user session
if, for example, the sysadmin walked away from the terminal. The virtual
displays are only ever visible to the person who made the connection so
there's no danger of this.

## Examples:

	The examples shown below come from a working configuration used in a
homogeneous network environment consisting of various MS Windows
platforms, Unix flavors, and Linux distributions. All except the oldest
have VNC server and viewers installed. The example represents only RHEL
4, but configuration would be very similar for other Unixes.

## Our Platform (you don't need that much hardware):

CPU:	Dual Dual-core Xeon 3.6 GHz
MEM:	8 GB
DISK:	1.5 TB RAID 0/1
OS:	RHEL 4 AS
VNC:	4.1.1-1
Xorg:	6.8.2-1.EL.13.25

################################
## Begin VNC Server on RHEL 4 ##
################################

## Legend:
	...	The appearance of an ellipsis indicates that the entries
		to/from this point are insignificant or repeat.
	===	Encloses part or all of the contents of a sample file.
	---	Separates sections of a file or separates title or
		heading from content

## First, download and install the latest VNC RPM at:
	http://www.realvnc.com/products/free/4.1/download.html

## Ensure system security is set to allow VNC connections to ports
you've configured

5900 is default TCP port
I'm also using ports 5952 5953 5962 5963 5972 5973 5980

One simple way is:

===============
/etc/hosts.deny
---------------
ALL: ALL
===============

================
/etc/hosts.allow
----------------
ALL: 192.168.1. 192.168.2. 192.168.3. 192.168.32. 10.1.150.
================


## Ensure that your system is set to startup in run level 5 with XDM
(GDM)

============
/etc/inittab
------------
...
id:5:initdefault:
...
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
============


======================
/etc/sysconfig/desktop
----------------------
DESKTOP="GNOME"
======================


=====================================================
diff /etc/X11/gdm/gdm.conf.orig /etc/X11/gdm/gdm.conf
-----------------------------------------------------
52c52
< #RemoteGreeter=/usr/bin/gdmlogin
---
> RemoteGreeter=/usr/bin/gdmlogin
211c211
< Enable=false
---
> Enable=true
214c214
< #HonorIndirect=true
---
> HonorIndirect=true
227a228
> DisplaysPerHost=4
230a232
> PingIntervalSeconds=300
298c300
< #ChooserButton=true
---
> ChooserButton=true
=====================================================


=====================
/etc/X11/gdm/gdm.conf
---------------------
[daemon]
AutomaticLoginEnable=false
AutomaticLogin=
TimedLoginEnable=false
TimedLogin=
TimedLoginDelay=30
Greeter=/usr/bin/gdmgreeter
RemoteGreeter=/usr/bin/gdmlogin
DefaultPath=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin
RootPath=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
User=gdm
Group=gdm
LogDir=/var/log/gdm
PidFile=/var/run/gdm.pid
PostLoginScriptDir=/etc/X11/gdm/PostLogin/
PreSessionScriptDir=/etc/X11/gdm/PreSession/
PostSessionScriptDir=/etc/X11/gdm/PostSession/
DisplayInitDir=/etc/X11/gdm/Init
XKeepsCrashing=/etc/X11/gdm/XKeepsCrashing
ServAuthDir=/var/gdm
BaseXsession=/etc/X11/xdm/Xsession
DefaultSession=default.desktop
UserAuthDir=
UserAuthFBDir=/tmp
UserAuthFile=.Xauthority
StandardXServer=/usr/X11R6/bin/X
Xnest=/usr/X11R6/bin/Xnest -audit 0 -name Xnest

[security]
AllowRoot=true
AllowRemoteRoot=true
AllowRemoteAutoLogin=false
RelaxPermissions=0
CheckDirOwner=true

[xdmcp]
Enable=true
HonorIndirect=true
DisplaysPerHost=4
PingIntervalSeconds=300

[gui]
GtkTheme=Bluecurve

[greeter]
TitleBar=false
ConfigAvailable=false
Browser=false
MinimalUID=500
Logo=
ChooserButton=true
BackgroundColor=#20305a
ShowGnomeFailsafeSession=false
ShowLastSession=false
GraphicalTheme=Default
GraphicalThemeDir=/usr/share/gdm/themes/

[chooser]
HostImageDir=/usr/share/hosts/
Hosts=
Broadcast=true
Multicast=false

[debug]
Enable=false

[servers]
0=Standard

[server-Standard]
name=Standard server
command=/usr/X11R6/bin/X -audit 0
flexible=true

[server-Terminal]
name=Terminal server
command=/usr/X11R6/bin/X -audit 0 -terminate
flexible=false
handled=false

[server-Chooser]
name=Chooser server
command=/usr/X11R6/bin/X -audit 0
flexible=false
chooser=true
=====================


## Add entries to /etc/services for display variations you will use

=============
/etc/services
-------------
...
# VNC Servers
vnc             5950/tcp        # VNC Service (using defaults)
vnc1024x768x8   5952/tcp        # VNC Service 1024x768, 8-bit color
depth
vnc1280x1024x8  5953/tcp        # VNC Service 1280x1024, 8-bit color
depth
vnc1024x768x16  5962/tcp        # VNC Service 1024x768, 16-bit color
depth
vnc1280x1024x16 5963/tcp        # VNC Service 1280x1024, 16-bit color
depth
vnc1024x768x24  5972/tcp        # VNC Service 1024x768, 24-bit color
depth
vnc1280x1024x24 5973/tcp        # VNC Service 1280x1024, 24-bit color
depth
vnc1280x960x24  5980/tcp        # VNC Service 1280x960, 24-bit color
depth
...
=============


## Create a VNC startup script for xinetd to start all necessary
services for your virtual VNC displays.

=================
/etc/xinetd.d/vnc
-----------------
# default: off
# description: VNC accepts connections from VNC viewers using XDMCP to \
#              manage the connections.
 
## [50] Default options: Color Depth: 16 Geometry 1024x768
service vnc
{
        flags           = REUSE
        protocol        = tcp
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -once
-securitytypes=none
        disable         = no
}
 
## [52] Color Depth: 8-bit Geometry: 1024x768
service vnc1024x768x8
{
        flags           = REUSE
        protocol        = tcp
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -once -geometry
1024x768 -depth 8 -securitytypes=none
        disable         = no
}
 
## [53] Color Depth: 8-bit Geometry: 1280x1024
service vnc1280x1024x8
{
        flags           = REUSE
        protocol        = tcp
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -once -geometry
1280x1024 -depth 8 -securitytypes=none
        disable         = no
}
                                                                                
## [62] Color Depth: 16-bit Geometry: 1024x768
service vnc1024x768x16
{
        flags           = REUSE
        protocol        = tcp
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -once -geometry
1024x768 -depth 16 -securitytypes=none
        disable         = no
}
 
## [63] Color Depth: 16-bit Geometry: 1280x1024
service vnc1280x1024x16
{
        flags           = REUSE
        protocol        = tcp
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -once -geometry
1280x1024 -depth 16 -securitytypes=none
        disable         = no
}
 
## [72] Color Depth: 24-bit Geometry: 1024x768
service vnc1024x768x24
{
        flags           = REUSE
        protocol        = tcp
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -once -geometry
1024x768 -depth 24 -securitytypes=none
        disable         = no
}
 
## [73] Color Depth: 24-bit Geometry: 1280x1024
service vnc1280x1024x24
{
        flags           = REUSE
        protocol        = tcp
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -once -geometry
1280x1024 -depth 24 -securitytypes=none
        disable         = no
}
 
## [80] Color Depth: 24-bit Geometry: 1280x960
## (special for Dennis)
service vnc1280x960x24
{
        flags           = REUSE
        protocol        = tcp
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/Xvnc
        server_args     = -inetd -query localhost -once -geometry
1280x960 -depth 24 -securitytypes=none
        disable         = no
}
=================


## Setup X to use the VNC Native display server for the root console :0

==================
/etc/X11/xorg.conf
------------------
...
Section "Module"
        ...
        Load  "vnc"
EndSection
...
Section "Screen"
        Identifier "Screen0"
        ...
        Option "SecurityTypes" "VncAuth"
        Option "UserPasswdVerifier" "VncAuth"
        Option "PasswordFile" "/root/.vnc/passwd"
EndSection
...
==================

## As "root" user set a vnc password for the VNC "Native Display" server

vncpasswd
(creates /root/.vnc/passwd)

## You'll have to restart the X server and xinetd to get things rolling.

## You may be able to do this using <Ctrl><Alt><Backspace> at a login
prompt.
If you're not already setup to boot into run level 5 with a respawning
xdm you may need to do a system restart.

## You'll need to restart xinetd to get it to re-read the config files.

service xinetd restart

## Lastly, you need to test connections from another machine upon which
you've already installed a VNC Viewer (client).

################################
## Begin VNC Server on RHEL 4 ##
################################


##################################
## Begin Java VNC Viewer Client ##
##################################

## To get the web server to offer a Java VNC client:

mkdir /var/www/html/vnc
cp /usr/share/vnc/classes/* /var/www/html/vnc/

## Add something like this to one of your html pages:
(I have a support page where we maintain tool links)

/var/www/html/support.html
=========================================================
...
<P><B><A HREF="documentation.html"> Documentation</A></B>
<P><B><A HREF="http://pegasus/vnc/index.vnc">VNC Viewer (Java)</A></B>
<P><B><A HREF=JavaScript: onclick="mindTerm();"
...
=========================================================

## You may have authentication problems when trying to connect to
machines other than the one on which the VNC jar file is installed. If
you want to use it this way you may need to "sign" the jar file. That's
beyond the scope of this post. A simpler way to use the Java client is
to copy it to your client machine and run it directly. 

## Run the Java VNC client directly:

Note: It's just as simple, if not more so, to install the Windows VNC
version so that's what I do.


## Install the latest JRE from the Sun Java site:
	http://www.java.com/en/download/index.jsp

## Copy the "vncviewer.jar" file to the (windoze) client machine

C:\Program Files\RealVNC\VNC4\vncviewer.jar

## Create a menu item or shortcut executing the jar file:

Target: "C:\Program Files\RealVNC\VNC4\vncviewer.jar"
Start in: "C:\Program Files\RealVNC\VNC4\"

################################
## End Java VNC Viewer Client ##
################################

Copy paste problem

Corné Beerse cbeerse at lycos.nl
Mon Aug 30 09:27:48 CEST 2004
Nepple, Bruce wrote:
> This happens in 5.4 and 5.3
> 
> I'm running xfce3 under linux through vnc4
> 
> I'm using nc with about 60 open sessions.
> 
> Ctrl-c and ctrl-v don't work. They have worked
> in the past, but not now.  If I start a new
> nedit session (not nc), it doesn't work either.
> 
> Middle mouse select/pasting works fine.
> 
> I suspect that it is desktop/vnc related, but
> hopefully  someone will have an idea where
> to start looking.

I'm roughly sure it is vnc related... The vnc-session (viewer and/or server) do 
only transfer the select-buffer from/to the X11 side. Other buffers are roughly 
not touched.

With vnc (well with version 3 or related at least) the copy-paste actions 
between a m$windows desktop and a unix-vnc-server do work in `xterm` and related 
"older" applications but not in current applications that do have cut-copy-paste 
menu options. With xclipboard you can roughly see whats happening and you can 
use that to get things going, at least as current workaround.

I do know stuff has changed in this area with the newer vnc version 4 but I 
still have not tested details. I already do know it is related to the version at 
the server (remote) side.



CBee

 

[Oct 3, 2007] VNC Copy and Paste Remote Desktop Sharing Problem - Ubuntu Forums

VNC server startup

I am using vnc (Release 3.3.3.r2-362) under SuSE 8.1.

If you don't have it installed get it from SuSE 'YAST2 Control Center': Install or Remove Software: Package Groups: X11: Utilities. You can then also try for 'Online update' to see if there is a newer version.

You will get files in:

/usr/X11R6/bin/ (Xvnc,vncpasswd, vncserver, vncviewer)
/usr/share/doc/packages/vnc (Documentation)
/usr/share/vnc/classes/ (Java classes for jvncviewer)
    

The script vncserver is a wrapper for Xvnc. I have changed the startup environment because I am using KDE. The change is on line 47; it now reads: startkde #&\n); The modified 'vncserver' is shown below.

. . .
. . .
$defaultXStartup
    = ("#!/bin/sh\n\n".
       "xrdb \$HOME/.Xresources\n".
       "xsetroot -solid grey\n".
       "xterm -geometry 80x24+10+10 -ls -title \"\$VNCDESKTOP Desktop\" &\n".
       "startkde &\n");

chop($host = `uname -n`);

. . .
. . .

In my setup I wanted to have the vncservers to come up at boot time and keep their context even after disconnecting the vnc-viewer. Some people prefer to start VNC through inetd, but this always gives you a fresh desktop and is also slow in starting up. I don't think that in my configuration I have a security issue; the server is behind a firewall with only http and smtp ports open. The local network is purely private (home LAN).

In order to achieve this I created a boot script called xvncserver under /etc/init.d which is included below as xvncserver.

#! /bin/sh
#
# Author: Willem van der Mark <wvdmark@computer.org>
#
# /etc/init.d/xvncserver	this Script
# /usr/sbin/rcvncserver		Root-Link to this Script
# /usr/X11R6/bin/vncserver	Program
#
# System startup script for vnc server
#
# LSB compatible service control script; see http://www.linuxbase.org/spec/
# 
# Note: This template uses functions rc_XXX defined in /etc/rc.status on
# UnitedLinux (UL) based Linux distributions. If you want to base your 
# script on this template and ensure that it works on non UL based LSB 
# compliant Linux distributions, you either have to provide the rc.status
# functions from UL or change the script to work without them.
#
#
### BEGIN INIT INFO
# Provides:       xvncserver
# Required-Start: $remote_fs $syslog $network xdm
# X-UnitedLinux-Should-Start: $network xdm
# Required-Stop:  $remote_fs $syslog $network xdm
# X-UnitedLinux-Should-Stop: $network xdm
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Description:    Start vncserver for remote control
#	
### END INIT INFO


# Check for missing binaries
VNC_WRAPPER=/usr/X11R6/bin/vncserver
test -x $VNC_WRAPPER || exit 5
VNC_MASTER=/usr/X11R6/bin/Xvnc
test -x $VNC_MASTER || exit 5
VNC_CONFIG=/etc/sysconfig/vncservers
test -r $VNC_CONFIG || exit 5

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num><num>
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status
#      rc_active	checks whether a service is activated by symlinks
. /etc/rc.status

# First reset status of this service
rc_reset

# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 

VNCSERVERS=""
VNCARGS=""
[ -f $VNC_CONFIG ] && . $VNC_CONFIG

prog=$"VNC server"

case "$1" in
    start)
		for display in ${VNCSERVERS}
		do
		if test -a /home/${display##*:}/.vnc/passwd ; then
			rm -fv /tmp/.X${display%%:*}-lock
			rm -fv /tmp/.X11-unix/X${display%%:*}
			echo -n "Starting $prog on: ${display} -- "
			su ${display##*:} -l -c "cd && vncserver :${display%%:*} ${VNCARGS}"
			[ $? -eq 0 ] && echo $rc_done_up || echo $rc_failed_up
		else
			echo -n "Vnc not initialised for user: ${display##*:}"
			echo $rc_failed ;
		fi
		done
    ;;
    stop)
		for display in ${VNCSERVERS}
		do
			echo -n "Shutting down $prog: ${display} "
			su ${display##*:} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
			[ $? -eq 0 ] && echo $rc_done || echo $rc_failed
		done
    ;;
    restart)
		$0 stop
		$0 start
		rc_status
    ;;
    status)
		echo -n "Checking for service Vnc-Server "
		## Check status with checkproc(8), if process is running
		## checkproc will return with exit status 0.

		# Return value is slightly different for the status command:
		# 0 - service running
		# 1 - service dead, but /var/run/  pid  file exists
		# 2 - service dead, but /var/lock/ lock file exists
		# 3 - service not running

		# NOTE: checkproc returns LSB compliant status values.
		checkproc $VNC_MASTER
		rc_status -v
    ;;
    *)
		echo "Usage: $0 {start|stop|status|restart}"
		exit 1
    ;;
esac
rc_exit

It is based on the skeleton provided in init.d and get its parameters from a file called 'vncservers' in /etc/sysconfig/. It contains 2 variables 'VNCSERVERS' and 'VNCARGS'. VNCSERVERS gives a series of 'screen number:user account' for each vnc-server you want to start. (not the root account; does not work, has not been tested, and it not recommendable). VNCARGS provides some extra parameters that will be passed to 'vncserver' or 'Xvnc'. This file is called vncservers. In this example the geometry of 940x705 prevents the vnc-viewer from clipping the Start bar in both Windows and Mac.

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :1
# as my 'myusername' (a legal user).  This user will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.  
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# URL:http://www.uk.research.att.com/vnc/sshvnc.html.
#
# VNCSERVERS="1:myusername ... ..."
#
VNCSERVERS="3:user1 4:user2"

# The VNCARGS variable contains arguments to vncserver (and Xvnc)
# which will be passed to all sessions; run 'man vncserver' or
# 'man Xvnc' to see which arguments are to be used.
#
# VNCARGS="-vncserversargs -Xvncargs"
#
VNCARGS="-geometry 940x705 -depth 16 -alwaysshared"

These options are then configurable in YAST2 'Editor for Sysconfig' under +etc: the following images

FedoraNEWS.ORG

What is VNC?

VNC stands for Virtual Network Computing. It is remote control software which allows you to view and interact with one computer (the "server") using a simple program (the "viewer") on another computer anywhere on the Internet. The two computers don't even have to be the same type, so for example you can use VNC to view an office Linux machine on your Windows PC at home. VNC is freely and publicly available and is in widespread active use by millions throughout industry, academia and privately.

For more information, please visit http://www.realvnc.com/

Do I have it in my system?

Type following command to check if you have the client and server installed in your system.

[tchung@tchung101 tchung]$ rpm -q vnc vnc-server
vnc-4.0-0.beta4.3.2
vnc-server-4.0-0.beta4.3.2
[tchung@tchung101 tchung]$

###

To configure vncserver as a service on your system, add yourself in following config file.

[tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/vncservers

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the line below to start a VNC server on display :1
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# URL:http://www.uk.research.att.com/vnc/sshvnc.html
                                                                                                    
# VNCSERVERS="1:myusername"
VNCSERVERS="1:tchung"

###

Before starting vncserver as a service, let's create a vnc password with vncpasswd command.
Notice it creates a hidden directory .vnc under your home account with file passwd which contains your vnc password.

[tchung@tchung101 tchung]$ vncpasswd
Password:
Verify:
[tchung@tchung101 tchung]$ ls -d .vnc
.vnc
[tchung@tchung101 tchung]$ ls .vnc
passwd
[tchung@tchung101 tchung]$

###

Now let's start vncserver as a service.

[tchung@tchung101 tchung]$ sudo /sbin/service vncserver start
Starting VNC server: 1:tchung                              [  OK  ]
[tchung@tchung101 tchung]$

Take a look at the contents of .vnc directory now. You should have something similiar to following.

[tchung@tchung101 tchung]$ cd .vnc
[tchung@tchung101 .vnc]$ ls
passwd  tchung101:1.log  tchung101:1.pid  xstartup
[tchung@tchung101 .vnc]$

If you edit the script called xstartup, you will notice following comment in red.
Uncomment those two lines in red as shown below!!! Otherwise, you will get nothing but grey screen.

#!/bin/sh
                                                                                                    
# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

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

###

Since we've just edited vnc startup script, let's restart the vncserver.

[tchung@tchung101 tchung]$ sudo /sbin/service vncserver restart
Shutting down VNC server: 1:tchung                         [  OK  ]
Starting VNC server: 1:tchung                              [  OK  ]
[tchung@tchung101 tchung]$

So how do I connect to vncserver? Use vncviewer command in vnc client as following.

[tchung@tchung101 tchung]$ vncviewer localhost:1

Enter your vnc password and here is the result: Screenshot


UPDATE:
To connect to a remote system with firewall, port 5901 needs to be open.
Add following line in red to open port 5091 and restart iptables service.

[tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/iptables
                                                                                                                                                             
# Firewall configuration written by redhat-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
                                                                                                                                                             
[tchung@tchung101 tchung]$ sudo /sbin/service iptables restart
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
Applying iptables firewall rules:                          [  OK  ]
[tchung@tchung101 tchung]$

Recommended Links


In case of broken links please try to use Google search. If you find the page please notify us about new location
Google     

Recommended papers

 

VNC over SSH

VNCOverSSH - Community Ubuntu Documentation

Set up the VNC Server in Fedora

  1. brunson Says :

    Creating an ssh tunnel is an unnecessary step. Read the vncview man page section on the ‘via’ option. Running ‘vncviewer -via machine.running.vncserver localhost:2′ will have vncviewer create the ssh tunnel for you. I find it particularly useful for accessing my sessions through a firewall since I can do ‘vncviewer -via mybastion.host mydesktop:2′

    I’m also suprised you don’t mention that vnc support is built into gnome. If you go into your menu items: Desktop -> Preferences -> Remote Desktop you can gain remote access to your gnome session running on the console. Not exactly the same as what you’re describing, but useful, nonetheless.

    I’m interested in having my vncserver session run my default gnome desktop. Has anyone sussed out the details on making that happen?

Vino (VNC server for Gnome)

Vino. The Remote Desktop Project

Configuring a VNC server in Linux bobpeers.com

VNC - Gentoo Linux Wiki

Vino is designed to be used with the Gnome desktop. It is very easy to setup. The connection is viewable in windowed mode.

The instructions are simple enough to be given here.

configure:
via the GUI:
vino-preferences &
OR hack with gconftool:
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true
OR hack the gconf xml:
vi ~/.gconf/desktop/gnome/remote_access/%gconf.xml
then restart the vino-session
start:
vino-session &

Jonh Wendell » Blog Archive » Improvements on Vino (GNOME Remote Access Desktop)

Vino. The Remote Desktop Project. Take 2.

RPM resource vino

FreeNX

NX is an open standard server built on top of X that simplifies thin-client networking. It includes built-in support for encryption (using SSH), access to the local filesystem and local audio. The server also is able to translate foreign protocols to allow connections from RDP and other clients. NX is a product of NoMachine, which develops an open-source core, on which proprietary versions of both the server and client are built. FreeNX is a completely open-source project.

http://fedoranews.org/contributors/rick_stout/freenx/

Cool Solutions Installing the Latest (As of Oct 2005) FreeNX Server on Novell Linux products

Warning: Once you used NX you'll NEVER GO BACK to VNC...
It is fast (compression and cache technology applied to the X protocol), allowing you to work remotely using a higher resolution,... and secure (it runs over SSH).

Reader Comments

  • FreeNX on SLE10 Just tried the following packages 1. nxclient-2.1.0-11.i386.rpm 2. nxnode-2.1.0-15.i386.rpm 3. nxserver-2.1.0-17.i386.rpm from NoMachine on SLE10. they work fine
  • Very nice! I -think- FreeNX comes with SUSE 10 (or it may have been in one of the APT repositories I've use) , so if you just want to access your home computer then you can use YAST (or apt / synaptic). Also, there is a free NXclient for KDE called kNX. My experience is that it isn't mature enough yet - it does not work - but your milage may vary.
  • Great hints! Thanks for the nice work. Made my whole nx system work... Just had a problem with the install of /usr/NX/lib that didn't get covered in your instructions (but is well described in the Free-0.4.4/INSTALL file. NX rocks!!!!
  • Great article. Just a couple of things to add 1) Need to add nx and other users that will connect to the sshlogin group in /etc/group 2) Need to import the client.id_dsa.key in the Configuration->General area other wise authentication will not work.
  • It's not quite as widely supported as VNC though, eh? A half-dozen linux distros and Solaris, while VNC is available for anything with a display and a network connection. Reply: NX Clients run on Windows, Linux, Mac OSX (BSDs), Solaris and apparently on some PDA's. Server runs on AFAIK ALL linx distro's, not half a dozen. NX is more secure and faster than vnc. NX can do even more: it can also convert RDP (Remote Desktop Protocol, used by Windows Terminal Servers) and RFB (used by VNC servers) to NX and thereby increase efficiency of these two protocols by a factor of up to 10 across slow links (even if you compare it to TightVNC!). A possible setup : Windows Terminal Server --lan--> NXServer --wan--> NX Client Start reading here http://www.linuxjournal.com/article/8477 Both systems are "free" and open source so as per usual YOU "HAVE TO" CHOOSE...

 

 


Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Disclaimer:

Last modified: August 08, 2009