6

Recently, I was following installation instructions for Guacamole in the manual on http://guac-dev.org/. My system is Ubuntu 14.04.

First, I installed the basic required dependencies:

$ apt-get install -y apache2 libcairo2-dev libjpeg62-dev libpng12-dev libossp-uuid-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libpulse-dev libssl-dev libvorbis-dev maven tomcat7
$ apt-get install -y libvncserver-dev

Then, I downloaded guacamole-server-0.9.8.tar.gz and guacamole-0.9.8.war and installed them according to the instructions in the manual:

$ tar xf guacamole-server-0.9.8.tar.gz
$ cd guacamole-server-0.9.8
$ ./configure
$ make
$ make install
$ cp guacamole-0.9.8.war /var/lib/tomcat7/webapps/guacamole.war
$ mkdir /etc/guacamole

I created the /etc/guacamole/guacamole.properties, containing the following:

guacd-hostname: localhost # although the guide says it should be guacd-host, but the example shown in http://guac-dev.org/doc/gug/configuring-guacamole.html is guacd-hostname
guacd-port: 4822
user-mapping: /etc/guacamole/user-mapping.xml

/etc/guacamole/user-mapping.xml contains the following:

<user-mapping>
    <authorize username="USERNAME" password="PASSWORD">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">5901</param>
        <param name="password">123456</param>
    </authorize>
    <authorize username="wangx" password="wangxiang">
        <protocol>vnc</protocol>
        <param name="hostname">192.168.1.111</param>
        <param name="port">5901</param>
        <param name="password">123456</param>
    </authorize>
</user-mapping>

I then restarted tomcat7 and guacd:

$ /etc/init.d/tomcat7 restart
$ /etc/init.d/guacd restart

The GUACAMOLE_HOME environment variable is empty:

$ echo $GUACAMOLE_HOME

There is no .guacamole directory in /home/<user> nor in /var/lib/tomcat7/webapps/guacamole. When I visit the http://localhost:8080/guacamole, I entered username "wangx" and password "wangxiang", it shows invalid login.

How can I solve this? Where should I locate the guacamole.properties and user-mapping.xml file? Did I do something wrong?

Thank you for your attention.

ramwin
  • 5,803
  • 3
  • 27
  • 29
  • This is still an issue in 2021. Guac doesn't properly log it's failures making debugging of problems impossible. Combined with the fact that it's difficult to install and configure. It's a pretty horrible piece of software overall. – Matviy Kotoniy Apr 14 '21 at 18:10

1 Answers1

12

according to the instructions in the manual:

...
$ mkdir /etc/guacamole

Guacamole will not automatically read from /etc/guacamole. It will read from GUACAMOLE_HOME, but this is not an environment variable - it is a placeholder for the Guacamole configuration directory which can be determined through an environment variable of the same name, but there are other possible locations. From the GUACAMOLE_HOME description in the Guacamole manual:

GUACAMOLE_HOME

Guacamole reads files from its own configuration directory by default, resorting to the classpath only when this directory cannot be found. When locating this directory, Guacamole will try, in order:

  1. The directory specified within the system property guacamole.home.
  2. The directory specified within the environment variable GUACAMOLE_HOME.
  3. The directory .guacamole, located within the home directory of the user running the servlet container.

This directory will be referred to as GUACAMOLE_HOME elsewhere in the documentation.

Guacamole uses GUACAMOLE_HOME as the primary search location for configuration file like guacamole.properties. ...

Your guacamole.properties and user-mapping.xml look fine, but Guacamole will not be able to find those files unless they are within GUACAMOLE_HOME. An extremely simple way to solve this would be to symbolically link .guacamole within the Tomcat user's home directory to /etc/guacamole. In the case of the "tomcat7" package on Ubuntu, the Tomcat user's home directory is /usr/share/tomcat7:

$ ln -s /etc/guacamole/ /usr/share/tomcat7/.guacamole

Alternatively, you could create the .guacamole directory, and make a symbolic link to guacamole.properties instead. Since the location of your user-mapping.xml is explicitly specified within your guacamole.properties, you do not need to place it within GUACAMOLE_HOME:

$ mkdir /usr/share/tomcat7/.guacamole
$ ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat7/.guacamole/

Be sure to restart Tomcat after you make these changes, and things should start working.

Mike Jumper
  • 410
  • 3
  • 8
  • Thank you. I did what you suggested in the answer, but still I can't login the guacamole. I had changed all the file "chmod 777 guacamole.properties" to ensure that tomcat7 can read the file. I don't know if there is anything I miss. – ramwin Nov 04 '15 at 02:37
  • 2
    Check the Tomcat logs (`/var/log/tomcat7/catalina.out`) for any errors. I made two different suggestions which are mutually exclusive - what specifically did you do? – Mike Jumper Nov 04 '15 at 20:08
  • Since my company don't want our guest to type in the password and username. I'm using django's authenticate and read the rdp or vnc password from database. And create the javaclass GuacamoleHTTPTuneelServlet to access the password automatically. So I don't get stuck in this question. Thank you. And my method is create a url where the username and password exist, and the java class deal with the url and get the necessary parameters. My code is at https://github.com/ramwin/my_guacamole_sample. – ramwin Apr 13 '16 at 07:15
  • Thanks! This worked however I have a different path to "CATALINA_HOME". It wasn't "/usr/share/tomcat7". "CATALINA_HOME" is the path where you unziped TOMCAT (where "bin", "conf", "webapps", etc.. folders are). – MPicazo Oct 31 '17 at 18:14
  • the alternative worked for ubuntu server 14.04 and guacamole 0.9.13 – stackoverflowsucks Nov 08 '17 at 09:02