Skip to content

Instantly share code, notes, and snippets.

@ppoffice
Last active June 6, 2025 02:55
Show Gist options
  • Save ppoffice/53347bc47edb1c5903c70a79f0a5e290 to your computer and use it in GitHub Desktop.
Save ppoffice/53347bc47edb1c5903c70a79f0a5e290 to your computer and use it in GitHub Desktop.
VNC xstartup for Ubuntu Desktop (Gnome)
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
vncconfig -iconic &
export DESKTOP_SESSION=/usr/share/xsessions/ubuntu.desktop
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
dbus-launch --exit-with-session /usr/bin/gnome-session --systemd --session=ubuntu
@zillani
Copy link

zillani commented Mar 10, 2025

I tried this on ubuntu 22.04 desktop & it works fine! Thank you! <3

@baoqianl
Copy link

this is a great post - it has been long and troublesome to get vncserver work on ubuntu - cannot image canonical folks don't have any doc on this part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment