-
Notifications
You must be signed in to change notification settings - Fork 0
Setup VNC connection to server
Allan Roger Reid edited this page Dec 4, 2024
·
2 revisions
Remote Desktop
sudo apt update
sudo apt install xfce4 xfce4-goodies -y
sudo apt install tigervnc-standalone-server -y
vncpasswd
cat << EOF > ~/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4
EOF
chmod u+x ~/.vnc/xstartup
vncserver
vncserver -list
vncserver -kill :1
sudo vi /etc/systemd/system/vncserver@.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=simple
User=ubuntu
PAMName=login
PIDFile=/home/%u/.vnc/%H%i.pid
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :%i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver :%i -geometry 1440x900 -alwaysshared -fg -localhost no
ExecStop=/usr/bin/vncserver -kill :%i
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl stop vncserver@1.service
sudo systemctl enable vncserver@1.service
sudo systemctl start vncserver@1.service
sudo systemctl status vncserver@1.service
where port was previously defined in the lxd node's streams definition e.g.
upstream perforce-bijan-vnc {
server perforce-bijan.lxd:5901;
}
server {
listen 20035;
listen [::]:20035;
proxy_pass perforce-bijan-vnc;
}
ssh -L 5901:127.0.0.1:5901 -N -f -l allan 1.2.3.4 -p 4492
or another example
ssh -L 5901:127.0.0.1:5901 -N -f -l allan allanroger.ddns.net
rm -rf /home/allan/.Xauthority-*
pkill Xtigervnc
Run vncserver
again or systemctl restart vncserver