Skip to content

Instantly share code, notes, and snippets.

@Xpl0itU
Last active February 17, 2023 16:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xpl0itU/d910f945902d324dd4f9b5299d18e6f5 to your computer and use it in GitHub Desktop.
Save Xpl0itU/d910f945902d324dd4f9b5299d18e6f5 to your computer and use it in GitHub Desktop.
Connect to an existing X11 session over VNC without X11VNC on Debian

Install tigervnc-scraping-server

sudo apt-get install tigervnc-scraping-server

Add a password to the VNC server

vncpasswd

Edit the xstartup file to work on Gnome

nano $HOME/.vnc/xstartup

Put the contents of the xstartup file I attached, after that, you need to make it executable

chmod +x $HOME/.vnc/xstartup

Setup service for the VNC server

mkdir -p $HOME/.local/share/systemd/user
nano $HOME/.local/share/systemd/user/vncserver@.service

Put there the contents of the file I attached, remember to change [YOUR_USER] to your actual account username

Start the service and enable it on boot

systemctl daemon-reload --user
systemctl start vncserver@0 --user
systemctl enable vncserver@0 --user
[Unit]
Description=TigerVNC Service
[Service]
Type=forking
ExecStartPre=-/usr/bin/x0vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/x0vncserver -passwordfile /home/[YOUR_USER]/.vnc/passwd -display :%i -localhost no
ExecStop=/usr/bin/x0vncserver -kill :%i
[Install]
WantedBy=default.target
#!/bin/bash
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/gnome-session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment