cat > \/etc\/guacamole\/guacamole.properties << EOL\nguacd-hostname: 127.0.0.1\nguacd-port: 4822\nuser-mapping: \/etc\/guacamole\/user-mapping.xml\nauth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider\nEOL\n<\/code><\/pre>\n\n\n\nThe configuration above is explained below;<\/p>\n\n\n\n
\nguacd-hostname: localhost<\/code>: This line sets the hostname of the Guacamole daemon (guacd) to “localhost.” The Guacamole daemon is responsible for handling remote desktop connections.<\/li>\n\n\n\nguacd-port: 4822<\/code>: This line specifies the port number (4822) on which the Guacamole daemon (guacd<\/code>) is listening for connections.<\/li>\n\n\n\nuser-mapping: \/etc\/guacamole\/user-mapping.xml<\/code>: This line specifies the path to the user mapping configuration file (user-mapping.xml<\/code>). This file defines how users are authenticated and which remote desktop connections they can access.<\/li>\n\n\n\nauth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider<\/code>: This line sets the authentication provider to be used for user authentication. In this case, the BasicFileAuthenticationProvider is used, which means authentication will be based on user credentials defined in the user-mapping.xml<\/code> file.<\/li>\n<\/ol>\n\n\n\nNext, link the Guacamole configurations directory to Tomcat servlet directory as shown below.<\/p>\n\n\n\n
ln -s \/etc\/guacamole \/usr\/share\/tomcat9\/.guacamole<\/pre>\n\n\n\nSimilarly, if you build Tomcat from Tomcat source, then;<\/p>\n\n\n\n
ln -s \/etc\/guacamole \/opt\/tomcat9\/.guacamole<\/code><\/pre>\n\n\n\nThere are different authentication methods supported by Guacamole;<\/p>\n\n\n\n
\nReading credentials from XML file (default<\/em>).<\/li>\n\n\n\nDatabase authentication<\/li>\n\n\n\n LDAP authentication<\/li>\n\n\n\n Retrieving secrets from a vault<\/li>\n\n\n\n Duo two-factor authentication<\/li>\n\n\n\n TOTP two-factor authentication<\/li>\n\n\n\n HTTP header authentication<\/li>\n\n\n\n Encrypted JSON authentication<\/li>\n\n\n\n CAS Authentication<\/li>\n\n\n\n OpenID Connect Authentication<\/li>\n\n\n\n SAML Authentication<\/li>\n\n\n\n RADIUS Authentication<\/li>\n<\/ul>\n\n\n\nGuacamole\u2019s default authentication method reads all users and connections from a single file called user-mapping.xml<\/code>. We enabled basic authentication in the configuration above.<\/p>\n\n\n\nIn this file,you need to define the users allowed to access Guacamole web UI<\/strong>, the servers to connect to<\/strong> and the method of connection<\/strong>.<\/p>\n\n\n\nNOTE: Storing sensitive information like passwords or connection details in plain text within the user-mapping.xml file can be a security risk, especially if the file is accessible to unauthorized users. If you are using Guacamole Over Internet, I recommend that you avoid the use of user-mapping.xml file for storing credentials. Also, ensure that HTTPS is implemented. Security starts from you!<\/strong><\/p><\/blockquote><\/figure>\n\n\n\nYou can choose to use other authentication methods below;<\/p>\n\n\n\n
\nConfigure TOTP Two-Factor Authentication on Apache Guacamole<\/a><\/li>\n\n\n\nConfigure Guacamole MySQL Database Authentication<\/a><\/li>\n\n\n\nSetup Apache Guacamole OpenLDAP Authentication<\/a><\/li>\n<\/ul>\n\n\n\nFor the purposes of local testing, we will be using this method, however!<\/p>\n\n\n\n
To begin with, generate the MD5 hash of passwords for the user to be used for logging into Guacamole web user interface.<\/p>\n\n\n\n
Replace your password, <password><\/code><\/strong>, accordingly<\/strong>;<\/p>\n\n\n\necho -n <password> | openssl md5<\/pre>\n\n\n\nFor example, where password<\/strong> is my password.<\/p>\n\n\n\necho -n password<\/strong> | openssl md5<\/code><\/pre>\n\n\n\nOutput;<\/p>\n\n\n\n
MD5(stdin)= 5f4dcc3b5aa765d61d8327deb882cf99<\/code><\/pre>\n\n\n\nor<\/p>\n\n\n\n
printf '%s' password | md5sum<\/pre>\n\n\n\nOutput;<\/p>\n\n\n\n
5f4dcc3b5aa765d61d8327deb882cf99 -<\/code><\/pre>\n\n\n\nBe sure to replace password<\/strong> with your strong password.<\/p>\n\n\n\nNext, create the default user authentication file, user-mapping.xml<\/strong><\/code> with the following contents.<\/p>\n\n\n\nvim \/etc\/guacamole\/user-mapping.xml<\/code><\/pre>\n\n\n\n\n<user-mapping>\n \n <!-- Per-user authentication and config information -->\n\n <!-- A user using md5 to hash the password\n guacadmin user and its md5 hashed password below is used to \n login to Guacamole Web UI-->\n <authorize \n username=\"guacadmin\"\n password=\"5f4dcc3b5aa765d61d8327deb882cf99\"\n encoding=\"md5\">\n\n <!-- First authorized Remote connection -->\n <connection name=\"Ubuntu 22\">\n <protocol>ssh<\/protocol>\n <param name=\"hostname\">192.168.58.37<\/param>\n <param name=\"port\">22<\/param>\n <\/connection>\n\n <!-- Second authorized remote connection -->\n <connection name=\"Windows 10\">\n <protocol>rdp<\/protocol>\n <param name=\"hostname\">192.168.56.121<\/param>\n <param name=\"port\">3389<\/param>\n <param name=\"username\">kifarunix<\/param>\n <param name=\"ignore-cert\">true<\/param>\n <\/connection>\n\n <\/authorize>\n\n<\/user-mapping>\n<\/code><\/pre>\n\n\n\nIf you don’t specify the username and password in the file, you will be prompted to provide them while attempting to login, which I consider it a bit secure.<\/p>\n\n\n\n
If you need to explicitly define usernames and passwords in the configuration file, add the parameters;<\/p>\n\n\n\n
<param name=\"username\">USERNAME<\/strong><\/param>\n<param name=\"password\">PASSWORD<\/param><\/strong><\/code><\/pre>\n\n\n\nSave and exit the configuration file.<\/p>\n\n\n\n
Restart both Tomcat and guacd to effect the changes.<\/p>\n\n\n\n
systemctl restart tomcat9 guacd<\/pre>\n\n\n\nBe sure to check the syslog, \/var\/log\/syslog<\/code> or \/var\/log\/tomcat9\/<\/code> log files for any issues.<\/p>\n\n\n\nAccessing Apache Guacamole from Browser<\/h3>\n\n\n\n Apache Guacamole server is now setup. You can access it from web browser using the address http:\/\/server-IP:8080\/guacamole<\/strong><\/code>.<\/a><\/p>\n\n\n