Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save xor-gate/add2a057ba53f4187d59e816e9e9a684 to your computer and use it in GitHub Desktop.

Select an option

Save xor-gate/add2a057ba53f4187d59e816e9e9a684 to your computer and use it in GitHub Desktop.
Gnome Vnc Server setup over NoVnc Protocol - Ubuntu 24.1 , Kali 24, Debian 12 Tested
# Replace {user} with your linux username
# e.g. @reboot /home/{user}/.start_vnc.sh -> @reboot /home/lenevo/.start_vnc.sh
sudo apt install task-gnome-desktop #debian
sudo apt install ubuntu-gnome-desktop #ubuntu
sudo apt install kali-desktop-gnome #ubuntu
#install gnome
sudo apt install tigervnc-standalone-server tigervnc-common git dbus-x11
#install tigervnc
vncserver :1 ; vncserver -kill:1
# start and kill the vnc server to generate nessesary files
vncpasswd
# setup vnc password
vncserver :1 -xstartup firefox -localhost no # optional: check if tigervnc is configured correctly , by connecting in port 5901 by vnc client
vncserver -kill:1 # optional: kill server after confirm
# test the connection - Optional
echo '#!/bin/bash
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xrdb $HOME/.Xresources
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
dbus-launch --exit-with-session gnome-session' > ~/.vnc/xstartup
# setup gnome for
vncserver :1 -localhost no # optional: check if tigervnc is configured correctly , by connecting in port 5901 by vnc client
vncserver -kill:1 # optional: kill server after confirm
# test the connection - Optional
cd /usr/share
git clone https://github.com/0xAungkon/noVNC
# clone the novnc repo from github
cd /noVNC/utils
openssl req -x509 -newkey rsa:2048 -keyout self.pem -out self.pem -days 365 -nodes
# configure ssl to work
echo '#!/bin/bash
vncserver -kill :1
vncserver :1
sudo /usr/share/novnc/utils/novnc_proxy --vnc localhost:5901 --listen 8443 --ssl-only
' > ~/.start_vnc.sh
chmod +x ~/.start_vnc.sh
# setup startvnc server file - novnc
crontab -e
@reboot /home/{user}/.start_vnc.sh
# setup corntab
#debug by / sandalone run
~/.start_vnc.sh
# If everything is okey the output will be
`Killing Xtigervnc process ID 294424... success!
New Xtigervnc server 'lenevo.lenev:1 (lenevo)' on port 5901 for display :1.
Use xtigervncviewer -SecurityTypes VncAuth -passwd /tmp/tigervnc.KlCZxw/passwd :1 to connect to the VNC server.
Using installed websockify at /usr/bin/websockify
Starting webserver and WebSockets proxy on port 8443
WebSocket server settings:
- Listen on :8443
- Web server. Web root: /usr/share/novnc
- SSL/TLS support
- Deny non-SSL/TLS connections
- proxying from :8443 to localhost:5901
Navigate to this URL:
https://lenevo:8443/vnc.html?host=lenevo&port=8443
Press Ctrl-C to exit`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment