VNC server com tigervnc#
Debian:
sudo apt install tigervnc-standalone-serverDefinindo senha:
vncpasswordExemplo de uso:
vncserver :0 -depth 24 -geometry 1280x800 -localhost no -AlwaysShared -- i3Para criar um serviço no systemd:
vncserver :0 -fg -depth 24 -geometry 1280x800 -SecurityTypes None --I-KNOW-THIS-IS-INSECURE -localhost no -AlwaysShared -- i3E também podemos usar via browser com websockfy:
websockify --web /usr/share/novnc/ 6080 localhost:5900Lembrando de que, tem de remover as configuraçoes antigas na interface, em config -> Advanced -> WebSocket -> Limpe todos os campos!!
Exemplo de um daemon systemd:#
file: /etc/systemd/system/vnc-i3wm@.service
[Unit]
[Service]
Type = simple
User=%i
WorkingDirectory=/home/%i
Environment="HOME=/home/%i"
ExecStart = vncserver :0 -fg -depth 24 -geometry 1280x800 -SecurityTypes None --I-KNOW-THIS-IS-INSECURE -localhost no -AlwaysShared -- i3
# ExecStartPost = websockify -D --web /usr/share/novnc/ 6080 0.0.0.0:5900
# ExecStartPost = websockify --run-once -D --web /usr/share/novnc/ 6080 localhost:5900
# Redireciona as saídas para /dev/null
StandardOutput=null
StandardError=null
[Install]
WantedBy = multi-user.targetPara ajudar na criação de novas resoluções:#
#! /bin/bash
function SET_DISPLAY (){
RESOLUTION="$1"
DISPLAY_NAME=$(xrandr | grep \ conne | awk '{print $1}')
echo "Display=$DISPLAY_NAME -> $RESOLUTION"
CMD=($(cvt -r ${RESOLUTION} | grep Modeline))
xrandr --newmode ${CMD[@]: 1}
xrandr --addmode $DISPLAY_NAME ${CMD[1]}
xrandr --output $DISPLAY_NAME --mode ${CMD[1]}
}
SET_DISPLAY "$1 $2"Para um display existente:#
[Unit]
[Service]
Type = simple
User=%i
WorkingDirectory=/home/%i
# Assume um display em :0
Environment="HOME=/home/%i DISPLAY=:0"
ExecStart = /usr/bin/x11vnc -loop -shared -skip_lockkeys -rfbport 5966
ExecStartPost = websockify -D --web /usr/share/novnc/ 6080 127.0.0.1:5966
StandardOutput=null
StandardError=null
[Install]
WantedBy = multi-user.targetnginx proxy reverso#
# Configuração existente [[...]]
# https://github.com/novnc/noVNC/wiki/Proxying-with-nginx
# Tem que instalar o novnc no server nginx para usar de base!!
location /vncws {
index vnc.html;
alias /usr/share/novnc/;
try_files $uri $uri/ /vnc.html;
}
location /vncws/websockify {
proxy_http_version 1.1;
proxy_pass http://192.168.0.55:6080/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# VNC connection timeout
proxy_read_timeout 61s;
# Disable cache
proxy_buffering off;
}
# Configuração existente [[...]]