Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ If you need an even smaller image:

| Variable | Default | Description |
|----------|---------|-------------|
| `DISPLAY` | `:0` | X display number |
| `RESOLUTION` | `1024x768` | Screen resolution |
| `VNC_PASSWORD` | (none) | VNC password (optional) |
| `ENABLE_VNC` | `true` | Enable VNC server |
Expand Down Expand Up @@ -196,4 +195,4 @@ docker build -t tiny-remote-desktop .

## License

Open source - use freely for personal and educational purposes.
This project does not yet include a formal license file. All rights are reserved by the maintainer unless otherwise stated. Please contact the maintainer for usage permissions.
22 changes: 19 additions & 3 deletions entry.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
#!/bin/sh

# Configure VNC password if provided
# Configure VNC password if provided (idempotent using -rfbauth)
if [ "$VNC_PASSWORD" ]; then
sed -i "s/^\(command.*x11vnc.*\)$/\1 -passwd '$VNC_PASSWORD'/" /etc/supervisord.conf
VNC_PASSFILE="/root/.vncpass"
x11vnc -storepasswd "$VNC_PASSWORD" "$VNC_PASSFILE"
chmod 600 "$VNC_PASSFILE"
# Make the change idempotent: remove any existing -passwd, -rfbauth, or -nopw args on the x11vnc command
sed -i \
-e '/command.*x11vnc/ s/ -passwd [^ ]*//g' \
-e '/command.*x11vnc/ s/ -rfbauth [^ ]*//g' \
-e '/command.*x11vnc/ s/ -nopw//g' \
/etc/supervisord.conf
# Append the auth file option to the x11vnc command
sed -i "s|^\(command.*x11vnc.*\)$|\1 -rfbauth ${VNC_PASSFILE}|" /etc/supervisord.conf
fi

# Ensure noVNC is not enabled when VNC is disabled
if [ "$ENABLE_NOVNC" = "true" ] && [ "$ENABLE_VNC" != "true" ]; then
echo "Warning: ENABLE_NOVNC=true requires ENABLE_VNC=true; disabling noVNC."
ENABLE_NOVNC="false"
fi

# Disable services based on environment variables
Expand All @@ -26,4 +42,4 @@ if [ "$AUTOSTART_FIREFOX" = "true" ]; then
chmod +x /root/.fluxbox/startup
fi

exec /usr/bin/supervisord
exec /usr/bin/supervisord
2 changes: 1 addition & 1 deletion menu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[encoding] {UTF-8}
[exec] (Firefox) {firefox}
[submenu] (System Tools)
[exec] (top) {xterm -e top}
[nop] (top (no terminal available))
[end]
[submenu] (Fluxbox menu)
[config] (Configure)
Expand Down
6 changes: 3 additions & 3 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
nodaemon=true

[program:X11]
command=/usr/bin/Xvfb :0 -screen 0 %(ENV_RESOLUTION)sx24
command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen 0 %(ENV_RESOLUTION)sx24
autorestart=true
priority=10

[program:x11vnc]
command=/usr/bin/x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -forever -nopw -wait 5 -shared -permitfiletransfer -tightfilexfer -rfbport 5901
command=/usr/bin/x11vnc -xkb -noxrecord -noxfixes -noxdamage -display %(ENV_DISPLAY)s -forever -wait 5 -shared -permitfiletransfer -tightfilexfer -rfbport 5901
autorestart=true
priority=20

Expand All @@ -20,7 +20,7 @@ priority=30
command=/usr/bin/fluxbox
autorestart=true
priority=40
environment=DISPLAY=":0"
environment=DISPLAY="%(ENV_DISPLAY)s"

[program:xrdp]
command=/usr/sbin/xrdp -n
Expand Down