Difference between revisions of "WebVNC"

From Amahi Wiki
Jump to: navigation, search
 
(46 intermediate revisions by 6 users not shown)
Line 1: Line 1:
The [[WebVNC]] package is for easily setting up a web-page that let's readers access a Java applet for VNC connections.  VNC is, simply put, graphical remote control desktop software.  With a Fedora-based Amahi install, it takes a few steps on the server to 1) install the package, 2) turn on desktop sharing.
+
{{NeedsUpdate}}
 +
 
 +
The [[WebVNC]] application sets up a web page to access a Java applet for VNC connections.  VNC is graphical remote control desktop software.  VNC allows you to connect to a desktop on the the Amahi server from a remote computer via a browser.  You must have a desktop session open on your HDA to be able to open a WebVNC session.
 +
 
 +
To establish remote desktop connectivity on a Fedora-based Amahi install, two elements are required: 
 +
#installation of the WebVNC application on the Amahi server and
 +
#installation of a VNC client on the remote computer.
  
 
<div style="border: 1px solid #B66; padding: .5em 1em; color: #000; background-color: #FEE; margin: 3px 3px 1em 3px;">
 
<div style="border: 1px solid #B66; padding: .5em 1em; color: #000; background-color: #FEE; margin: 3px 3px 1em 3px;">
'''Note: The procedure below allows anyone in your network to access this machine to connect to your session, if they know the password.  Be sure this is what you want.'''
+
'''Note: The procedure below allows anyone in your network to access a desktop on your Amahi server if they know the password.  Be sure this is what you want.'''
 
</div>
 
</div>
  
== Install the Package ==
+
== Install the WebVNC Package ==
 
 
* Goto http://setup
 
* Select the applications tab
 
* Click on WebVNC
 
* Click the install icon to install it on your HDA
 
  
'''NOTE:''' a very common issue is that ''you must have a desktop session open'' on your HDA to be able to open a WebVNC session.  If you have a headless HDA server, see below.
+
# Go to http://setup
 +
# Select the Apps tab
 +
# Select the Available option
 +
# Click on WebVNC
 +
# Click the install icon to install the WebVNC server package on your HDA
  
That should be all you need to do for the web application setup!
+
'''NOTE:'''  ''You must have a desktop session open'' on your HDA to be able to open a WebVNC session. If you have a headless HDA server, see below.
  
 
==Setup VNC Server==
 
==Setup VNC Server==
Sorry, some manual work needed to run the server
 
* Log into the computer running HDA, e.g. as a normal user
 
* Edit the file /etc/sysconfig/vncservers (with your favorite text editor)
 
Set the lines starting with VNCSERVER to read (remove the # at the start of the line)
 
 
<small>
 
VNCSERVERS="1:''yourusername''"
 
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"
 
</small>
 
 
where ''yourusername'' is the desktop user you use to access your HDA desktop.
 
 
[[VNC|Click Here]] more details on setting up VNC on your HDA.
 
  
 +
Sorry, some manual work is needed to run the server:
 +
1. Log into the computer running the HDA as a normal user
 +
2. Launch a command line/terminal session (From the GNOME desktop, select Applications > System Tools > Terminal)
 +
3. Login as super user:<br />
 +
su -
 +
:password: ''enter root password''<br /><br />
 +
4. Change the permissions of /etc/sysconfig/vncservers to allow editing with the following command:<br />
 +
chmod 777 /etc/sysconfig/vncservers
 +
5. Open the file /etc/sysconfig/vncservers with a text editor (Applications > Accessories > gedit Text Editor on the GNOME desktop) and add the following two lines to the bottom of the file:<br />
 +
VNCSERVERS="0:''yourusername''"
 +
VNCSERVERARGS[0]="-geometry 1024x768 -depth 16"
 +
'''NOTE:'''  ''yourusername'' is the desktop user you use to login to your HDA desktop. Make sure there is no # comment symbol in front of your entries.  This entry will create a 1024 x 768  desktop with 16M colors on your remote machine.<br /><br />
 +
You can set the desktop resolution to any value you want -- see below.  You can also setup sessions for multiple users and computers.  More detailed instructions are available [http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/ here].<br /><br />
 +
6. Change the file permissions back:<br />
 +
chmod 244 /etc/sysconfig/vncservers
  
 
== Turn on Desktop Sharing ==
 
== Turn on Desktop Sharing ==
Line 36: Line 43:
 
Unless you do this, your VNC session or your desktop will have a message asking someone to accept or refuse connections, and your client will be stuck waiting!
 
Unless you do this, your VNC session or your desktop will have a message asking someone to accept or refuse connections, and your client will be stuck waiting!
 
</div>
 
</div>
* Log into the computer running HDA, e.g. as a normal user
+
# Log into your desktop on the HDA computer.
* Select SYSTEM menu, then Preferences, then Internet and Network, then Remote Desktop
+
# Select System > Preferences > Remote Desktop
* Turn on the top two "sharing" options, turn off the "Ask for confirmation" option, but set a password below it.
+
# Turn on the two "sharing" options, turn off the "Ask for confirmation" option, set a password, turn on "Configure Network automatically to accept connections."
  
'''Note: This allows anyone with network access to this machine to connect to your session, if they know the password.  Be sure this is what you want.'''
+
::[[File:Remote_Desktop_Preferences.PNG]]
 +
 
 +
'''NOTE:''' This allows anyone with network access to this machine to connect to your session, if they know the password.  Be sure this is what you want.
  
 
== Using the App ==
 
== Using the App ==
 
You should now be able to access: [http://webvnc http://webvnc].  Give it a minute to start up, then enter your password.
 
You should now be able to access: [http://webvnc http://webvnc].  Give it a minute to start up, then enter your password.
  
Note: ''' You must have a desktop session started on your HDA for WebVNC to display.'''  
+
'''Reminder:''' You must have a desktop session started on your HDA for WebVNC to display.
 +
 
 +
* Leave any questions or discussion on the [[Talk:WebVNC]] page.
 +
 
 +
== Quickly Change Resolution ==
 +
You can create a script to quickly change the resolution of your HDA's desktop and update your WebVNC window.  This technique involves keeping several different configuration files for your WebVNC and adjusting a symlink to reference the correct configuration.
 +
 
 +
First, as root, make a copy of your WebVNC webpage configuration in your user folder for EACH desired resolution, with the following commands:
 +
 
 +
cd /var/hda/web-apps/webvnc/html
 +
cp index.html /home/%USER%/.amahi.webvnc.800x600.index.html
 +
cp index.html /home/%USER%/.amahi.webvnc.1024x768.index.html
 +
  cp index.html /home/%USER%/.amahi.webvnc.1280x1024.index.html
  
Leave any questions or discussion on the [[Talk:WebVNC]] page.
+
You will need to edit each of these files to change the size of the VNC window inside the web page.  The width of the window should match the width of your desktop, however the height of the window should have 22px added to the height of the desktop in order to account for the WebVNC menu.  For example, for the resolution 800x600, the html file will look like this:
 +
 +
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
 +
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;&gt;
 +
  &lt;head&gt;
 +
  &lt;title&gt;WebVNC Client&lt;/title&gt;
 +
  &lt;meta http-equiv="Content-Language" content="en-us" /&gt;
 +
  &lt;meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /&gt;
 +
  &lt;head&gt;
 +
  &lt;body style="font-size:8px;background-color:#000000;font-family:arial, helvetica, sans-serif;font-color:#007500;text-align:center;"&gt;
 +
  &lt;div style="position:relative;margin: 0 auto;width:800px;height:622px;"&gt;
 +
    &lt;applet code=VncViewer.class codebase=classes/ width="800" height="622"&gt;
 +
    &lt;param name=PORT value=5900&gt;
 +
    &lt;param name="Open New Window" value="no"&gt;
 +
    &lt;/applet&gt;&lt;br /&gt;
 +
  &lt;/div&gt;
 +
  &lt;a href="http://hda/"&gt;Return to HDA Home&lt;/a&gt;
 +
  &lt;/body&gt;
 +
&lt;/html&gt;
  
Screenshot of desktop sharing setup below - sorry it's so huge.
+
Next, remove the original index.html file and create a symlink to the appropriate new file:
 +
rm index.html
 +
ln -s /home/%USER%/.amahi.webvnc.800x600.index.html index.html
  
http://content.screencast.com/users/spatialguru/folders/Jing/media/996c7c1d-05a9-4a92-9d87-f89167742a3c/00000032.png
+
Now you need a script in order to change the resolution of the desktop AND update the symlink to the correct configuration. Create a file in /home/%USER%/Scripts/ for each desired resolution, for example, amahi.webvnc.reschange.800x600.sh containing the following, making sure to enter your sudo password and the desired resolution:
  
== Troubleshooting ==
+
#!/bin/bash
A very basic issue -- '''you must have a desktop session open''' on your HDA to be able to open a WebVNC session.
+
echo ::password:: | sudo -S rm -f /var/hda/web-apps/webvnc/html/index.html
 +
sudo ln -s /home/%USER%/.amahi.webvnc.800x600.index.html /var/hda/web-apps/webvnc/html/index.html
 +
sudo xrandr -s 800x600
  
Two typical scenarios pop up as problematic.  One, is to make sure you have a password defined as above.  Second, make sure the confirmation checkbox is deactivated, unless you are sitting in front of the HDA itself.  Otherwise it will just sit there indefinitely waiting for someone to click a button on the screen of the HDA.
+
Finally, make each of your scripts executable (chmod u+x %SCRIPT%), place a drawer on your panel with a launcher to each of your scripts, then to change resolutions select your launcher and refresh your WebVNC window.
  
Please note that at the present time, and according to the above, only port 5900 (VNC display :0) is supported.  If you want to change that, then manually edit /var/hda/web-apps/webvnc/html/index.html and change 5900 to desired number (e.g. :1 = 5901, :2=5902, etc).
+
== Troubleshooting ==
 +
*A very basic issue: '''you must have a desktop session open''' on your HDA to be able to open a WebVNC session.
  
If when trying to connect with WebVNC you get a message on the Amahi box "Enter password for default keyring to unlock" then you need to delete or rename the default keyring:
+
* Make sure you have a password defined as above. 
  
To delete:
+
* Ensure the confirmation checkbox is deactivated, unless you are sitting in front of the HDA itself.  Otherwise it will just sit there indefinitely waiting for someone to click a button on the screen of the HDA.
  
  rm ~/.gnome2/keyrings/default.keyring
+
* Please note that at the present time, and according to the above, only port 5900 (VNC display :0) is supported. If you want to change that, then manually edit /var/hda/web-apps/webvnc/html/index.html and change 5900 to desired number (e.g. :1 = 5901, :2=5902, etc).
  
or backup:
+
* If when trying to connect with WebVNC you get a message on the Amahi box "Enter password for default keyring to unlock" then you need to delete or rename the default keyring:
  
 +
:To delete:
 +
~/.gnome2/keyrings/default.keyring
 +
:or backup:
 
  mv ~/.gnome2/keyrings/default.keyring ~/.gnome2/keyrings/default.keyring.bak
 
  mv ~/.gnome2/keyrings/default.keyring ~/.gnome2/keyrings/default.keyring.bak
  
 
== Headless Servers ==
 
== Headless Servers ==
  
If your HDA server is headless, then WebVNC is not for you (because you will not have a desktop session running).  Instead, install a VNC client on your remote computer and [[VNC|VNC Server]] on the HDA.   
+
If your HDA server is headless, then WebVNC is not for you (because you will not have a desktop session running).  Instead, install a VNC client on your remote computer and [[VNC|VNC Server]] on the HDA.
 +
 
 +
 
 +
There is however a hack to allow you to run WebVNC from a headless serverThis is rather complex, and will not allow you to boot with a monitor attached without changing files again. 
 +
 
 +
You need to modify you xorg.conf to emulation a monitor.
 +
 
 +
cd /etc/X11/
 +
nano xorg.conf
 +
:save it as xorg.conf.bak
 +
nano xorg.conf
 +
:replace everything with
 +
 
 +
      Section "Monitor"
 +
            Identifier "Monitor0"
 +
            HorizSync 31-81
 +
            VertRefresh 56-75
 +
      EndSection
 +
      Section "Device"
 +
            Identifier "Card0"
 +
            Driver "vesa"
 +
      EndSection
 +
      Section "Screen"
 +
            Identifier "Screen0"
 +
            Device "Card0"
 +
            Monitor "Monitor0"
 +
      EndSection
 +
 
 +
:save and close xorg.conf
 +
 
 +
nano /boot/grub/grub.conf
 +
:save it as gru
 +
b.conf.bak
 +
nano /boot/grub/grub.conf
 +
:add above title Fedora
 +
      GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
 +
 
 +
Reboot
 +
 
 +
If you ever want to use a monitor, you just need to restore the .bak files.
 
      
 
      
  
 
[[Category:Apps]]
 
[[Category:Apps]]

Latest revision as of 15:37, 5 April 2014

Msgbox.update.png Update Needed
The contents of this page have become outdated or irrelevant. Please consider updating it.

The WebVNC application sets up a web page to access a Java applet for VNC connections. VNC is graphical remote control desktop software. VNC allows you to connect to a desktop on the the Amahi server from a remote computer via a browser. You must have a desktop session open on your HDA to be able to open a WebVNC session.

To establish remote desktop connectivity on a Fedora-based Amahi install, two elements are required:

  1. installation of the WebVNC application on the Amahi server and
  2. installation of a VNC client on the remote computer.

Note: The procedure below allows anyone in your network to access a desktop on your Amahi server if they know the password. Be sure this is what you want.

Install the WebVNC Package

  1. Go to http://setup
  2. Select the Apps tab
  3. Select the Available option
  4. Click on WebVNC
  5. Click the install icon to install the WebVNC server package on your HDA

NOTE: You must have a desktop session open on your HDA to be able to open a WebVNC session. If you have a headless HDA server, see below.

Setup VNC Server

Sorry, some manual work is needed to run the server: 1. Log into the computer running the HDA as a normal user 2. Launch a command line/terminal session (From the GNOME desktop, select Applications > System Tools > Terminal) 3. Login as super user:

su -
password: enter root password

4. Change the permissions of /etc/sysconfig/vncservers to allow editing with the following command:

chmod 777 /etc/sysconfig/vncservers

5. Open the file /etc/sysconfig/vncservers with a text editor (Applications > Accessories > gedit Text Editor on the GNOME desktop) and add the following two lines to the bottom of the file:

VNCSERVERS="0:yourusername"
VNCSERVERARGS[0]="-geometry 1024x768 -depth 16"

NOTE: yourusername is the desktop user you use to login to your HDA desktop. Make sure there is no # comment symbol in front of your entries. This entry will create a 1024 x 768 desktop with 16M colors on your remote machine.

You can set the desktop resolution to any value you want -- see below. You can also setup sessions for multiple users and computers. More detailed instructions are available here.

6. Change the file permissions back:

chmod 244 /etc/sysconfig/vncservers

Turn on Desktop Sharing

Unless you do this, your VNC session or your desktop will have a message asking someone to accept or refuse connections, and your client will be stuck waiting!

  1. Log into your desktop on the HDA computer.
  2. Select System > Preferences > Remote Desktop
  3. Turn on the two "sharing" options, turn off the "Ask for confirmation" option, set a password, turn on "Configure Network automatically to accept connections."
Remote Desktop Preferences.PNG

NOTE: This allows anyone with network access to this machine to connect to your session, if they know the password. Be sure this is what you want.

Using the App

You should now be able to access: http://webvnc. Give it a minute to start up, then enter your password.

Reminder: You must have a desktop session started on your HDA for WebVNC to display.

  • Leave any questions or discussion on the Talk:WebVNC page.

Quickly Change Resolution

You can create a script to quickly change the resolution of your HDA's desktop and update your WebVNC window. This technique involves keeping several different configuration files for your WebVNC and adjusting a symlink to reference the correct configuration.

First, as root, make a copy of your WebVNC webpage configuration in your user folder for EACH desired resolution, with the following commands:

cd /var/hda/web-apps/webvnc/html
cp index.html /home/%USER%/.amahi.webvnc.800x600.index.html
cp index.html /home/%USER%/.amahi.webvnc.1024x768.index.html
cp index.html /home/%USER%/.amahi.webvnc.1280x1024.index.html

You will need to edit each of these files to change the size of the VNC window inside the web page. The width of the window should match the width of your desktop, however the height of the window should have 22px added to the height of the desktop in order to account for the WebVNC menu. For example, for the resolution 800x600, the html file will look like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">>
 <head>
  <title>WebVNC Client</title>
  <meta http-equiv="Content-Language" content="en-us" />
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
 <head>
 <body style="font-size:8px;background-color:#000000;font-family:arial, helvetica, sans-serif;font-color:#007500;text-align:center;">
  <div style="position:relative;margin: 0 auto;width:800px;height:622px;">
   <applet code=VncViewer.class codebase=classes/ width="800" height="622">
    <param name=PORT value=5900>
    <param name="Open New Window" value="no">
   </applet><br />
  </div>
  <a href="http://hda/">Return to HDA Home</a>
 </body>
</html>

Next, remove the original index.html file and create a symlink to the appropriate new file:

rm index.html
ln -s /home/%USER%/.amahi.webvnc.800x600.index.html index.html

Now you need a script in order to change the resolution of the desktop AND update the symlink to the correct configuration. Create a file in /home/%USER%/Scripts/ for each desired resolution, for example, amahi.webvnc.reschange.800x600.sh containing the following, making sure to enter your sudo password and the desired resolution:

#!/bin/bash
echo ::password:: | sudo -S rm -f /var/hda/web-apps/webvnc/html/index.html
sudo ln -s /home/%USER%/.amahi.webvnc.800x600.index.html /var/hda/web-apps/webvnc/html/index.html
sudo xrandr -s 800x600

Finally, make each of your scripts executable (chmod u+x %SCRIPT%), place a drawer on your panel with a launcher to each of your scripts, then to change resolutions select your launcher and refresh your WebVNC window.

Troubleshooting

  • A very basic issue: you must have a desktop session open on your HDA to be able to open a WebVNC session.
  • Make sure you have a password defined as above.
  • Ensure the confirmation checkbox is deactivated, unless you are sitting in front of the HDA itself. Otherwise it will just sit there indefinitely waiting for someone to click a button on the screen of the HDA.
  • Please note that at the present time, and according to the above, only port 5900 (VNC display :0) is supported. If you want to change that, then manually edit /var/hda/web-apps/webvnc/html/index.html and change 5900 to desired number (e.g. :1 = 5901, :2=5902, etc).
  • If when trying to connect with WebVNC you get a message on the Amahi box "Enter password for default keyring to unlock" then you need to delete or rename the default keyring:
To delete:
~/.gnome2/keyrings/default.keyring
or backup:
mv ~/.gnome2/keyrings/default.keyring ~/.gnome2/keyrings/default.keyring.bak

Headless Servers

If your HDA server is headless, then WebVNC is not for you (because you will not have a desktop session running). Instead, install a VNC client on your remote computer and VNC Server on the HDA.


There is however a hack to allow you to run WebVNC from a headless server. This is rather complex, and will not allow you to boot with a monitor attached without changing files again.

You need to modify you xorg.conf to emulation a monitor.

cd /etc/X11/
nano xorg.conf
save it as xorg.conf.bak
nano xorg.conf
replace everything with
      Section "Monitor"
           Identifier "Monitor0"
           HorizSync 31-81
           VertRefresh 56-75
      EndSection
      Section "Device"
           Identifier "Card0"
           Driver "vesa"
      EndSection
      Section "Screen"
           Identifier "Screen0"
           Device "Card0"
           Monitor "Monitor0"
      EndSection
save and close xorg.conf
nano /boot/grub/grub.conf
save it as gru

b.conf.bak

nano /boot/grub/grub.conf
add above title Fedora
     GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"

Reboot

If you ever want to use a monitor, you just need to restore the .bak files.