⬅️ **[[$-Tools|Tools]]** *** # VNC ## Setup Ubuntu [How to Install & Configure VNC Server on Ubuntu 20.04](https://bytexd.com/how-to-install-configure-vnc-server-on-ubuntu-20-04/) sudo apt update sudo apt install xfce4 xfce4-goodies sudo apt install tigervnc-standalone-server vncserver -> specify password -> change PW with vncpasswd vncserver -kill :1 vim ~/.vnc/xstartup #!/bin/sh xrdb $HOME/.Xresources startxfce4 & #!/bin/sh: This line, commonly referred to as shebang, tells the system which interpreter we will be using. In this case, it’s the bash interpreter. Other Linux shells include Almquist shell, KornShell, etc. xrdb $HOME/.Xresources: This line tells the VNC server to read the .Xresources file where users can make changes on the graphical desktop general settings like fonts, color, etc. startxfce4 &: This line tells VNC which Desktop Environment to launch. startxfce4 is a script responsible for starting an Xfce session. chmod +x ~/.vnc/xstartup sudo vim /etc/systemd/system/[email protected] [Unit] Description= Tiger VNC Server service After=syslog.target network.target [Service] Type=forking User=mauritz Group=mauritz WorkingDirectory=/home/mauritz PIDFile=/home/mauritz/.vnc/%H:%i.pid ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1 ExecStart=/usr/bin/vncserver -geometry 1920x1080 -depth 24 -localhost :%i ExecStop=/usr/bin/vncserver -kill :%i [Install] WantedBy=multi-user.target make the system aware of our new unit file systemctl daemon-reload sudo systemctl enable [email protected] sudo systemctl stop vncserver@1 sudo systemctl start vncserver@1 sudo systemctl status vncserver@1 ## Setup Windows 1. VNC Viewer - Download and Install UltraVNC 2. Download Tigervnc - https://bintray.com/tigervnc/ - .tar.gz 3. Extract .tar.gz - `sudo tar -xzf tigervnc-Linux-ARCHITEKTUR-VERSION.tar.gz -C /` 4. Copy `hpvncserver` script into `/usr/local/bin/`: - `/usr/local/bin/hpvncserver` ```bash #!/bin/bash ## /usr/local/bin/hpvncserver PATH="$PATH:/usr/bin/" value=( $( cat ~/.hp_displayvar ) ) DISPLAY="$value" echo ">>>>> Used Display: ${DISPLAY} <<<<<" DEPTH="16" GEOMETRY="1366x768" ## accessibale via "ip:5901" && "localhost:5901" with SSH Port Forwarding #OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}" ## "-localhost" to connect only via localhost through secure SSH port 5901 forwarding OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost" case "$1" in start) /usr/bin/vncserver ${OPTIONS} ;; stop) /usr/bin/vncserver -kill :${DISPLAY} ;; restart) $0 stop $0 start ;; esac exit 0 ``` 5. Edit xstartup --> xfce Window Manager - `~/.vnc/xstartup` - `exec /bin/sh /etc/xdg/xfce4/xinitrc` # *** Related: - [[$-Netzwerk|Netzwerk]] - [[$-Linux|Linux]]