java user-mapping.xml 文件在 guacamole 中不起作用,登录无效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33499048/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The user-mapping.xml file doesn't work in guacamole, Invalid login
提问by ramwin
Recently, I was following installation instructions for Guacamole in the manual on http://guac-dev.org/. My system is Ubuntu 14.04.
最近,我按照http://guac-dev.org/上的手册中的 Guacamole 安装说明进行操作。我的系统是 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.gzand guacamole-0.9.8.warand installed them according to the instructions in the manual:
然后,我根据手册中的说明下载guacamole-server-0.9.8.tar.gz并guacamole-0.9.8.war安装了它们:
$ 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:
我创建了/etc/guacamole/guacamole.properties,包含以下内容:
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.xmlcontains the following:
/etc/guacamole/user-mapping.xml包含以下内容:
<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:
然后我重新启动了 tomcat7 和 guacd:
$ /etc/init.d/tomcat7 restart
$ /etc/init.d/guacd restart
The GUACAMOLE_HOMEenvironment variable is empty:
该GUACAMOLE_HOME环境变量为空:
$ echo $GUACAMOLE_HOME
There is no .guacamoledirectory 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.
.guacamolein/home/<user>和 in 中都没有目录/var/lib/tomcat7/webapps/guacamole。访问时http://localhost:8080/guacamole,输入用户名“wangx”和密码“wangxiang”,显示登录无效。
How can I solve this? Where should I locate the guacamole.propertiesand user-mapping.xmlfile? Did I do something wrong?
我该如何解决这个问题?我应该在哪里找到guacamole.properties和user-mapping.xml文件?我做错什么了吗?
Thank you for your attention.
感谢您的关注。
回答by Mike Jumper
according to the instructions in the manual:
... $ mkdir /etc/guacamole
根据手册中的说明:
... $ 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 canbe determined through an environment variable of the same name, but there are other possible locations. From the GUACAMOLE_HOMEdescription in the Guacamole manual:
鳄梨酱不会自动从/etc/guacamole. 它将从 读取GUACAMOLE_HOME,但这不是环境变量- 它是 Guacamole 配置目录的占位符,可以通过同名的环境变量确定,但还有其他可能的位置。从GUACAMOLE_HOME鳄梨酱手册中的描述:
GUACAMOLE_HOMEGuacamole 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:
- The directory specified within the system property
guacamole.home.- The directory specified within the environment variable
GUACAMOLE_HOME.- The directory
.guacamole, located within the home directory of the user running the servlet container.This directory will be referred to as
GUACAMOLE_HOMEelsewhere in the documentation.Guacamole uses
GUACAMOLE_HOMEas the primary search location for configuration file likeguacamole.properties. ...
GUACAMOLE_HOMEGuacamole 默认从它自己的配置目录中读取文件,只有在找不到该目录时才使用类路径。定位此目录时,Guacamole 将尝试按顺序:
- 在系统属性中指定的目录
guacamole.home。- 在环境变量中指定的目录
GUACAMOLE_HOME。- 目录
.guacamole,位于运行 servlet 容器的用户的主目录中。该目录将
GUACAMOLE_HOME在文档中的其他地方引用。Guacamole
GUACAMOLE_HOME用作配置文件的主要搜索位置,例如guacamole.properties. ...
Your guacamole.propertiesand user-mapping.xmllook 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 .guacamolewithin 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:
您的guacamole.properties和user-mapping.xml看起来不错,但是 Guacamole 将无法找到这些文件,除非它们在GUACAMOLE_HOME. 解决此问题的一种极其简单的方法是.guacamole在 Tomcat 用户的主目录中以符号方式链接到/etc/guacamole. 对于 Ubuntu 上的“tomcat7”包,Tomcat 用户的主目录为/usr/share/tomcat7:
$ ln -s /etc/guacamole/ /usr/share/tomcat7/.guacamole
Alternatively, you could create the .guacamoledirectory, and make a symbolic link to guacamole.propertiesinstead. Since the location of your user-mapping.xmlis explicitly specified within your guacamole.properties, you do not need to place it within GUACAMOLE_HOME:
或者,您可以创建.guacamole目录,并创建一个符号链接guacamole.properties。由于您的位置在您的user-mapping.xml中明确指定guacamole.properties,因此您无需将其放置在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.
进行这些更改后,请务必重新启动 Tomcat,一切都应该开始工作了。

