WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Remote Control via x11vnc (Server) and SSVNC (Viewer)  (Read 5811 times)

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Remote Control via x11vnc (Server) and SSVNC (Viewer)
« on: January 25, 2012, 07:47:01 AM »
A how-to with worked examples covering:

SCOPE
MAIN FEATURES
GOALS
SSVNC VIEWER
Optional - Multiple User Machine
Optional - Starting via a Menu Entry (or wbar)
Optional - File Transfer for Machines With Less Than 256MB RAM
X11VNC SERVER
Optional - Incorporate Viewer
Optional - Enable On-Screen Chat


SCOPE
Although the following shows the use of these in partnership, they do not require each other.  Either may be used independently.  Using them together does provide additional benefits, some of which are illustrated below.

Both the server and viewer are extensively documented:
http://www.karlrunge.com/x11vnc/
http://www.karlrunge.com/x11vnc/ssvnc.html
The range of options means the following descriptions are neither comprehensive or exhaustive.  They are intended to outline the manner in which some of the more common features might be set up.

To extend the range of the illustrations, different versions of TC are used for the viewer and the server.  Additionally, optional elements are indicated.   Together, these may assist users to select a set up that suits their needs.


MAIN FEATURES
  • Cross-platform versions of the viewer are available (Linux, Mac, Windows)
  • Control of both viewer and server functions may be performed via GUI
  • Secure connection via SSH, SSL, or both together (or none)
  • Server can automatically produce .crt and .pem certificates (SSL)
  • Viewer can import and save certificate from server via GUI
  • Viewer can store and load connection parameters to various servers as separate profiles via GUI
  • Control the desktop of a remote machine
  • Access to remote control session may be password protected
  • In-built two way clipboard transfer between server and viewer
  • Scaling the local display of the remote desktop during a live session
  • In-built two way file transfer between server and viewer
  • A dedicated file transfer server is not required on the x11vnc machine
  • A specific user account is not required on the x11vnc machine for file transfer
  • File transfer launch is integrated into the local display of the remote desktop
  • In-built, two way, on screen chat between server and viewer


GOALS
  • Demonstrate use on low spec (older) machines
  • Illustrate how to install and configure a viewer, a server and optional items for each
  • Following a reboot, the server is to start unattended, ready to accept an incoming  connection
  • Provide an example of SSL based security.  Many examples of using SSH exist. How to use an insecure (no security) connection is reasonably obvious


SSVNC VIEWER
  • Machine specs: CPU=333MHz, RAM=500MB, Disk Swap Space=200MB, NIC=100Mb
  • Operating system=Tiny Core 4.2.1
  • Persistent storage: /home, /opt, /tce
  • Window Manager=JWM
  • Viewer application=ssvnc_unix_only-1.0.30.tar.gz from the web site of the author.  This is basically a collection of binaries that do not need to be installed, just unpacked.  A few main dependencies are required that are commonly included by default in many distros.  Due to the nature of Tiny Core some are not provided by a stock installation of the operating system. If a few extensions have been installed there is a good chance that some of them will have already been obtained as dependencies.
1. Download ssvnc_unix_only-1.0.30.tar.gz

2. Extract in the home directory
Code: [Select]
tar -xzf ssvnc_unix_only-1.0.30.tar.gz
3. Ensure the following extensions are loaded
Code: [Select]
openssh.tcz
openssl-1.0.0.tcz
perl5.tcz
sun-jre7.tcz
tk.tcz
Xlibs.tcz
Xorg-7.6-lib.tcz
Note: sun-jre7.tcz is optional and may be omitted if desired. It is required to enable in-built file transfer.  If enabled, the viewer machine should have a minimum of 256MB RAM. For an alternative see "Optional - File Transfer for Machines With Less Than 256MB RAM".

4. To start SSVNC, open a terminal in the home directory and enter
Code: [Select]
SSVNC_XTERM_REPLACEMENT='aterm -e' ./ssvnc/Unix/ssvnc
5. Once an x11vnc server is set up it can be contacted by entering its ip address and display number in "VNC Host:Display" for example 192.168.1.15:0

6. The certificate for an SSL connection may be obtained from the server via the "Fetch Cert" button.  It may then be given a meaningful name and saved as a profile.  On subsequent use, a profile may be selected via the "Load" button and used to contact the server via the "Connect" button.


Optional - Multiple User Machine
The set up described above is OK for a machine having a single user account.  For a multiple user machine, it will mean having multiple instances of SSVNC, i.e. one in the home directory of each user.  It might be preferable to have a single instance that is available to all users. 

Create directory /opt/portable and extract ssvnc_unix_only-1.0.30.tar.gz in it. The command to start SSVNC is
Code: [Select]
SSVNC_XTERM_REPLACEMENT='aterm -e' /opt/portable/ssvnc/Unix/ssvnc


Optional - Starting via a Menu Entry (or wbar)
This requires the addition of an icon file (user choice) and creation of a .desktop file.  In turn this requires that squashfs-tools is loaded to produce them as a .tcz file.  Lastly, dependencies are listed in a .dep file.

Staying close to the description in of how to do this given in the Tiny Core Wiki...
1. Create /tmp/package/usr/local/share/pixmap/ssvnc.png

2. Create /tmp/package/usr/local/share/applications/ssvnc.desktop

3. Edit ssvnc.desktop to contain
Code: [Select]
[Desktop Entry]
Name=SSVNC
Comment=Access remote VNC desktops
Exec=env SSVNC_XTERM_REPLACEMENT`echo -e '\075'`'aterm -title SSVNC-Auxiliary -e' /opt/portable/ssvnc/Unix/ssvnc
Terminal=false
Type=Application
Categories=Network;RemoteAccess;
Icon=ssvnc.png
X-FullPathIcon=/usr/local/share/pixmaps/ssvnc.png
Notes:
SSVNC is designed to use xterm. "env SSVNC..." allows aterm to be used instead
JWM would not accept an equals sign (=) in the "Exec=..." line.  "`echo -e '\075'`" is an alternative means of providing it


4. In a terminal enter
Code: [Select]
cd /tmp
mksquashfs package ssvnc.tcz
cd /tmp/package
find usr -not -type d > ssvnc.tcz.list

5. Create a plain text file named ssvnc.tcz.dep and list the dependencies mentioned above.

6. Place a copy of ssvnc.tcz and ssvnc.tcz.dep in /tce/optional and load in the usual manner

Having followed this route, it is a short step to compiling the extension in full.  Any user is openly invited to do so and add it to the TC repository as a further way of installing the application.


Optional - File Transfer for Machines With Less Than 256MB RAM
The in-built file transfer mechanism is convenient, intuitive to use, and thereby user-friendly.  It is provided via Java which means a 45MB extension has to be loaded.  In Tiny Core terms this is very large and may rule out its use on machines with less than 256MB of available RAM.

By trading away some of the user-friendliness it is possible to obtain a similar function that is less demanding of resources. Filezilla might be used in place of Java.  It is also cross platform and is capable of secure (SSL) connections.  In empirical (non-stringent) tests, RAM requirements were of the order of 15% of that used by the Java application.

Using a traditional FTP client on the SSVNC viewer machine also requires the use of a discrete FTP server on the x11vnc server machine.  To continue the use of SSL, vsftpd-ssl can be used and configured to use the .pem (server) certificate generated by x11vnc.  This route also requires that suitable user accounts are created and managed.  The resource cost is minor.




X11VNC SERVER
  • Machine specs: CPU=800MHz, RAM=128MB, Disk Swap Space=0MB, NIC=100Mb
  • Operating system=Tiny Core 3.8.4
  • Persistent storage: /home, /opt, /tce
  • Window manager=JWM
  • Server application=x11vnc version 0.9.12 from the TC3 repository.  Install via onboot.lst in order to ensure it is automatically loaded following a reboot of the machine
  • In this illustration, server configuration is conducted via entries in files that are read during the start up sequence of the machine.  This ensures the server is automatically placed into operational condition
  • To simplify the illustration, the standard user account, tc is used
1. Create a plain text file ~/.X.d/x11vnc

2. Edit it to contain
Code: [Select]
### x11VNC REMOTE CONTROL SERVER
# Start the server as an unpriviledged user to control the display that is seen by the local user
#  -ssl "SAVE-$(hostname)"     Require an encrypted SSL/TLS tunnel between server and viewer
#                              and create the private/public certificates
#  -rfbauth  ~/.vnc/passwd     Require a password to be provided by the remote user
#  -bg                         Run in the background after screen setup
#  -cursor arrow               Use an arrow as the mouse pointer
#  -gui tray                   Display an icon in the system tray
#  -env X11VNC_FONT_REG_SMALL='Helvetica -12'     Set the font used in the tray icon menu
x11vnc  -ssl "SAVE-$(hostname)"  -rfbauth ~/.vnc/passwd  -bg  -cursor arrow  -gui tray  -env X11VNC_FONT_REG_SMALL='Helvetica -12'  &

3. Create a password in ~/.vnc/passwd (this is done one time only)
Code: [Select]
x11vnc -storepasswd
4. Reboot to verify that x11vnc runs automatically

5. In a terminal enter
Code: [Select]
ps -A | grep x11vncIt should report something similar to
Code: [Select]
2346 tc       x11vnc -ssl SAVE-box -rfbauth /home/tc/.vnc/passwd -bg -cursor arrow -gui tray -env X11VNC_FONT_REG_SMALL=Helvetica -12
2348 tc       tail -f /tmp/x11vnc.tray.EnO0Hb
2351 tc       [x11vnc]
2365 tc       [x11vnc]
2368 tc       [x11vnc]
2387 tc       grep x11vnc

6. The server is now ready to accept an incoming conection


Optional - Incorporate Viewer
It is possible for a single machine to combine the functions of an x11vnc server and an SSVNC viewer.  This requires the addition of the viewer software as described above, in which a machine is set up to operate only as a SSVNC viewer.

1. Download ssvnc_unix_only-1.0.30.tar.gz

2. Extract in /opt/portable
Code: [Select]
tar -xzf ssvnc_unix_only-1.0.30.tar.gz
3. Ensure the following extensions are loaded
Code: [Select]
openssh.tcz
openssl-0.9.8.tcz
perl5.tcz
sun-jre7.tcz
tk.tcz
Xlibs.tcz
Xorg-7.5-lib.tcz
Note: sun-jre7.tcz is optional and may be omitted if desired.

4. To start SSVNC, in a terminal enter
Code: [Select]
SSVNC_XTERM_REPLACEMENT='aterm -e' /opt/portable/ssvnc/Unix/ssvnc

Optional - Enable On-Screen Chat
Chat depends upon SSVNC being locally available.  Add it as described in Optional - Incorporate Viewer, it must then be appended to the path.

Edit ~/.profile to contain
Code: [Select]
### SSVNC REMOTE CONTROL VIEWER
# Note: To enable a local instance of x11vnc server to conduct a chat session with a remote
#       SSVNC viewer a local copy of SSVNC must be available in the local path
# If it exists add the location of SSVNC to the path
[ -d /opt/portable/ssvnc/bin ] && export PATH=$PATH:/opt/portable/ssvnc/bin

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 5020
    • My Community Forum
Re: Remote Control via x11vnc (Server) and SSVNC (Viewer)
« Reply #1 on: January 25, 2012, 10:05:01 AM »
Wouldn't be better it as a WIKI article?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: Remote Control via x11vnc (Server) and SSVNC (Viewer)
« Reply #2 on: January 26, 2012, 02:01:14 AM »
Hi bmarkus,

Wouldn't be better it as a WIKI article?
My experience leads me to conclude that a wider user group have different expectations of forum posts and wiki articles.

There is a general acceptance that forum posts may become stale over a period of time.  The information within them may however still contain some items of interest that might help prevent "reinventing the wheel".

Whether rightly or wrongly, wiki articles are often perceived as containing current information, i.e. they are maintained to reflect changes as they occur. 

Browsing through the wiki highlights areas which have become stale, i.e. they have not been maintained.  Fulfilling this is also unusually difficult due to the rate of change within the Core project as a whole.

As I am unable to commit to maintaining the information, the forum seemed to be the more appropriate location.  If another member(s) would like to maintain the information and create a wiki article based upon the forum post that is fine with me.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 5020
    • My Community Forum
Re: Remote Control via x11vnc (Server) and SSVNC (Viewer)
« Reply #3 on: January 26, 2012, 02:12:05 AM »
Forum is dynamic. Personally I'm not reading any forum post which is longer than half screen. It's just my kink.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."