Remote Desktops: noVNC
Remote desktops put a full Linux GUI behind a browser tab, which powers agentic computer-use workloads, secure browsing sessions, and disposable workstations. They are memory-hungry and used in short, interactive bursts, so each desktop runs in its own instance that scales to zero between sessions.
This guide explains how to create and deploy a noVNC app, allowing you to access remote desktops through a web interface inside a modern browser.
Note: Anthropic's Computer Use Demo inspired this example.
To run this example, follow these steps:
-
Install the unikraft CLI. You need a BuildKit builder. The easiest way to get one is via Docker. Alternatively, you can also directly set up and use BuildKit, see the quick start.
-
Clone the
examplesrepository andcdinto theexamples/novnc-browserdirectory:Code
Make sure to log into Unikraft Cloud and pick a metro close to you.
This guide uses fra (Frankfurt, 🇩🇪):
Code
When done, invoke the following command to deploy this app on Unikraft Cloud:
Code
Replace <my-password> with a long random password.
For more information, see Authentication.
The output shows the instance address and other details:
Code
In this case, the instance name is vnc-browser and the address is https://weathered-fog-y5jjmwfd.fra.unikraft.app.
The name was preset, but the address is different for each run.
Enter the provided address into your browser of choice to access the remote desktop interface.
The browser asks for a user name and a password.
Use the user name novnc and the password from NOVNC_PASSWORD.
You can list information about the instance by running:
Code
Code
When done, you can remove the instance:
Code
Authentication
When you set the NOVNC_PASSWORD environment variable, each request to the remote desktop must have one of these credentials:
- HTTP Basic Auth with the user name and the password. The browser shows a login dialog.
- The query parameter
token=<password>, for a link that opens the desktop without a login dialog. - The session cookie, which the browser gets after a login with
token.
Unikraft Cloud encrypts the connection with TLS.
| Variable | Value | Default |
|---|---|---|
NOVNC_PASSWORD | Password for the remote desktop | No authentication |
NOVNC_USER | User name for HTTP Basic Auth, without a : | novnc |
If NOVNC_PASSWORD is set but empty, the desktop does not start.
The same applies to an empty NOVNC_USER when the desktop has a password.
If you do not set NOVNC_PASSWORD, the remote desktop has no authentication.
A person who knows the address can control the desktop.
The instance log then shows WARNING: noVNC has no authentication.
A program, for example an AI agent, can also use the desktop.
It can send the Authorization: Basic <base64 of user:password> header with each request, also with the WebSocket request to /websockify.
For example:
Code
With Playwright, set the credentials on the browser context:
Code
To open the desktop with a link, put the URL-encoded password in the token parameter:
Code
The desktop then sets a session cookie and sends the browser to the same address without token.
Thus, the password does not stay in the address bar.
The browser history can keep the link with the password, so do not open the link on a shared computer.
The link needs HTTPS, because the browser keeps the session cookie only on a secure connection.
In the token parameter, a + is a space, and a &, % or # breaks the link.
To URL-encode the password, run this command and type the password:
Code
An agent can also connect to the WebSocket with the token: wss://weathered-fog-y5jjmwfd.fra.unikraft.app/websockify?token=<my-password>.
The password in a token parameter is in the address of the first request.
Proxies can write this address to their logs.
A page of another site can show the desktop in a frame.
Put vnc.html and the token in the address of the frame:
Code
In a frame, the address keeps the token. The page that shows the frame contains the password, thus show this page only to persons who can know the password. Without the token in the address of the frame, a page of another site cannot show the desktop in a frame. A page of another site cannot connect to the WebSocket of the desktop.
Do not put the credentials in the address as https://user:password@....
Some browsers do not send them with the WebSocket request.
Learn more
Use the --help option for detailed information on using Unikraft Cloud:
Code
Or visit the CLI Reference.