Set Up Apache Guacamole as an HTML5 RDP/SSH Gateway on Ubuntu 26.04
Install Apache Guacamole 1.6.0 on Ubuntu 26.04 with Docker, MariaDB and Nginx, and reach your SSH and RDP hosts from a browser.
Apache Guacamole is a clientless remote desktop gateway: you log in to a web page and open RDP, SSH or VNC sessions to your servers in the browser. Put it on one small server and you can close public SSH and RDP on everything behind it, with every session going through a single authenticated, logged entry point. This guide installs Guacamole 1.6.0 on Ubuntu 26.04 LTS (the steps are the same on 24.04 LTS) using the project's official Docker images, a MariaDB database and Nginx with HTTPS in front.
Older guides for Ubuntu 16.04 compiled Guacamole 0.9.x from source and deployed it on the distribution's Tomcat 8 package. Ubuntu 16.04 is long out of standard support, and the packaging has moved on: the official guacamole/guacamole image bundles its own Tomcat 9, so the container route avoids both the build and the question of which Tomcat your release ships.
Requirements
- An Ubuntu 26.04 or 24.04 server with at least 1 GB of RAM and a user with
sudorights. - A domain name pointing at the server. The examples use
guac.example.com. - Network access from this server to the machines you want to reach, ideally over a private network, on their SSH (22), RDP (3389) or VNC ports.
Step 1: Configure the firewall
Allow SSH and web traffic, then enable UFW:
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
Guacamole's own port, 8080, stays closed. Nginx will be the only public entry point.
Step 2: Install Docker Engine
Install Docker from Docker's official apt repository:
sudo apt update
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 3: Create the project and the database schema
Guacamole consists of two containers: guacd, the daemon that speaks RDP, SSH and VNC, and guacamole, the web application. A third container runs MariaDB, which stores users, connections and history.
Create a working directory:
sudo mkdir -p /opt/guacamole/initdb
cd /opt/guacamole
Guacamole does not create its own tables. The web application image contains a script that prints the schema; save its output where the MariaDB container will load it on first start:
sudo docker run --rm guacamole/guacamole:1.6.0 /opt/guacamole/bin/initdb.sh --mysql | sudo tee initdb/01-schema.sql > /dev/null
Generate two database passwords and store them in an environment file that only root can read:
printf 'DB_ROOT_PASSWORD=%s\nDB_PASSWORD=%s\n' "$(openssl rand -hex 24)" "$(openssl rand -hex 24)" | sudo tee .env > /dev/null
sudo chmod 600 .env
Step 4: Write the Compose file
Create /opt/guacamole/compose.yaml:
sudo nano /opt/guacamole/compose.yaml
services:
guacd:
image: guacamole/guacd:1.6.0
restart: unless-stopped
db:
image: mariadb:11.8
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MARIADB_DATABASE: guacamole_db
MARIADB_USER: guacamole_user
MARIADB_PASSWORD: ${DB_PASSWORD}
volumes:
- db-data:/var/lib/mysql
- ./initdb:/docker-entrypoint-initdb.d:ro
guacamole:
image: guacamole/guacamole:1.6.0
restart: unless-stopped
depends_on:
- guacd
- db
environment:
GUACD_HOSTNAME: guacd
MYSQL_HOSTNAME: db
MYSQL_DATABASE: guacamole_db
MYSQL_USERNAME: guacamole_user
MYSQL_PASSWORD: ${DB_PASSWORD}
REMOTE_IP_VALVE_ENABLED: "true"
ports:
- "127.0.0.1:8080:8080"
volumes:
db-data:
The GUACD_HOSTNAME and MYSQL_* variables are the ones the Guacamole manual lists for its image, and the MARIADB_* variables make the database image create the database and its user on first start. Four details matter here. The port is published on 127.0.0.1 only: ports that Docker publishes are routed before UFW's rules apply, so publishing 8080 on all interfaces would expose it to the internet regardless of the firewall. And the initdb directory is imported into guacamole_db only the first time MariaDB starts with an empty data volume. The database image is pinned to one release series (11.8) so that a later docker compose pull brings patch releases but never moves your data to a new MariaDB series unattended. Finally, REMOTE_IP_VALVE_ENABLED makes the bundled Tomcat read the visitor's address from the X-Forwarded-For header that Nginx adds in the next step, so the connection history records real client addresses rather than the proxy's.
Start the stack:
sudo docker compose up -d
sudo docker compose ps
All three services should be listed as running. Check that the application answers locally:
curl -I http://127.0.0.1:8080/guacamole/
Step 5: Put Nginx and HTTPS in front
Install Nginx and Certbot:
sudo apt install -y nginx certbot python3-certbot-nginx
Create /etc/nginx/sites-available/guacamole:
server {
listen 80;
listen [::]:80;
server_name guac.example.com;
location = / {
return 302 /guacamole/;
}
location /guacamole/ {
proxy_pass http://127.0.0.1:8080;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
client_max_body_size 1g;
access_log off;
}
}
proxy_buffering off is required: with buffering on, Nginx holds back the stream Guacamole sends to the browser and sessions hang. The Upgrade and Connection headers enable WebSocket, and client_max_body_size raises Nginx's 1 MB upload limit so file transfers work.
Enable the site, test the configuration and reload:
sudo ln -s /etc/nginx/sites-available/guacamole /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Request a Let's Encrypt certificate. Certbot edits the server block to add HTTPS and a redirect:
sudo certbot --nginx -d guac.example.com
Step 6: Log in and secure the admin account
Open https://guac.example.com/guacamole/ and sign in with the default account: user guacadmin, password guacadmin. Anyone can look those up, so deal with them immediately:
- Open the menu under your user name, choose Settings, then Preferences, and change the password.
- Better still, under Settings, Users, create a new administrator with a different name, log in as that user and delete
guacadmin.
To require a one-time code at login, add this line to the environment section of the guacamole service and run sudo docker compose up -d again. Each user is asked to enrol an authenticator app at the next login:
TOTP_ENABLED: "true"
Step 7: Add connections
Under Settings, Connections, choose New Connection.
- SSH: set the protocol to SSH, enter the target's hostname or private IP and port 22, and either a username with password or a private key. Leave the credentials empty to be prompted on each connect.
- RDP: set the protocol to RDP, enter the host and port 3389, the username, password and, where needed, the domain. Windows hosts normally use self-signed RDP certificates, so tick Ignore server certificate for hosts on a network you trust.
Save, return to the home screen and click the connection to open it in the browser. The connection is made from the guacd container, so the target must accept connections from this server's address.
Step 8: Close direct access to the targets
When the connections work through Guacamole, restrict SSH and RDP on the target machines to the gateway's address. On a target that uses UFW, with 203.0.113.10 as the gateway (use its private address if the servers share a private network):
sudo ufw allow from 203.0.113.10 to any port 22 proto tcp
sudo ufw delete allow OpenSSH
Run the second command only if an OpenSSH rule exists, and keep your provider's web console available as a fallback before you remove general SSH access.
Maintenance
View logs when a connection fails. guacd reports protocol errors such as refused connections and failed logins:
cd /opt/guacamole
sudo docker compose logs --tail 50 guacd
sudo docker compose logs --tail 50 guacamole
Back up the database, which holds all users and connections:
sudo docker compose exec db sh -c 'mariadb-dump -u root -p"$MARIADB_ROOT_PASSWORD" guacamole_db' | sudo tee /opt/guacamole/guacamole_db.sql > /dev/null
To upgrade, read the release notes first, because some releases need a database schema update. Then change the image tags in compose.yaml, pull and recreate:
sudo docker compose pull
sudo docker compose up -d
Frequently asked questions
Can I still install Guacamole without Docker?
Yes. The manual describes a native install: build guacamole-server from source with ./configure --with-systemd-dir=/usr/local/lib/systemd/system, make and make install, then deploy guacamole.war in a servlet container. It is more work to set up and to upgrade, and you have to supply a servlet container the web application supports yourself.
Do I need to install anything on the machines I connect to?
No agent is needed. Guacamole uses the SSH, RDP or VNC service the target already runs, and users only need a browser.
Can I use PostgreSQL instead of MariaDB?
Yes. Guacamole supports PostgreSQL through the same mechanism, with its own set of environment variables and initdb.sh --postgresql for the schema. The manual's database authentication chapters list the variable names.
Where is the session history?
Under Settings, History, administrators see who opened which connection, when, and for how long. The records are stored in the database, so they are included in the dump above.