Created
July 15, 2021 22:44
-
-
Save guilhermegazzinelli/1997fef3b5fbb4c05d86d8b1244f40ea to your computer and use it in GitHub Desktop.
Install vncserver and shows current desktop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Instalando VNC server" | |
sudo apt install tigervnc-standalone-server tigervnc-scraping-server tigervnc-common tigervnc-xorg-extension tigervnc-viewer | |
echo "Configure a senha padrão" | |
vncserver | |
echo "Realizando backup do arquivo de configuração" | |
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak | |
echo "Configurando arquivo de execução do ambiente" | |
cat >~/.vnc/xstartup <<EOL | |
#!/bin/bash | |
PATH=/usr/bin:/usr/sbin | |
unset SESSION_MANAGER | |
unset DBUS_SESSION_BUS_ADDRESS | |
exec env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd --session=ubuntu & | |
EOL | |
echo "Criando arquivo de inicialização" | |
sudo touch /etc/systemd/system/vncserver@.service | |
sudo cat >/etc/systemd/system/vncserver@.service <<EOL | |
[Unit] | |
Description=Remote desktop service (VNC) | |
After=syslog.target network.target | |
[Service] | |
Type=simple | |
User=$USER | |
PAMName=login | |
PIDFile=/home/%u/.vnc/%H%i.pid | |
ExecStartPre=/usr/bin/vncserver -kill :%i > /dev/null 2>&1 || : | |
ExecStart=/usr/bin/vncserver :%i -localhost no -geometry 1024x768 | |
ExecStop=/usr/bin/vncserver -kill :%i | |
[Install] | |
WantedBy=multi-user.target | |
EOL | |
echo "Reiniciando systemd manager" | |
sudo systemctl daemon-reload | |
x0vncserver -passwordfile ~/.vnc/passwd -display :0 | |
#https://gilgil.gitlab.io/2020/05/29/1.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment