UNCLASSIFIED

Skip to content
Snippets Groups Projects
Commit 7a61d5ec authored by Bryan Gagne's avatar Bryan Gagne
Browse files

Delete vnc_linux.sh

parent cbbf16bc
No related merge requests found
Pipeline #109407 passed with stages
in 59 seconds
#!/bin/bash
# updates
apt-get update -y
apt-get upgrade -y
#dependencies
apt install -y expect
# regular connection password
pass="defaultPassword"
# view only connection password
viewpass="defaultViewOnlyPassword"
# ----- Begin install tightvnc as service with regular connection and view only connection
apt install xfce4 xfce4-goodies -y
apt install -y tightvncserver
apt-get install tigervnc-common -y
vncserver -kill :1
prog=/usr/bin/vncpasswd
/usr/bin/expect <<EOF
spawn "$prog"
expect "Password:"
send "$pass\r"
expect "Verify:"
send "$pass\r"
expect "Would you like to enter a view-only password (y/n)?"
send "y\r"
expect "Password:"
send "$viewpass\r"
expect "Verify:"
send "$viewpass\r"
expect eof
exit
EOF
touch /root/.vnc/xstartup
echo '#!/bin/bash' > /root/.vnc/xstartup
echo "xrdb $HOME/.Xresources" >> /root/.vnc/xstartup
echo "startxfce4 &" >> /root/.vnc/xstartup
chmod +x /root/.vnc/xstartup
touch /etc/systemd/system/vncserver@.service
echo "[Unit]" >> /etc/systemd/system/vncserver@.service
echo "Description=Start TightVNC server at startup" >> /etc/systemd/system/vncserver@.service
echo "After=syslog.target network.target" >> /etc/systemd/system/vncserver@.service
echo "[Service]" >> /etc/systemd/system/vncserver@.service
echo "Type=forking" >> /etc/systemd/system/vncserver@.service
echo "User=root" >> /etc/systemd/system/vncserver@.service
echo "Group=root" >> /etc/systemd/system/vncserver@.service
echo "WorkingDirectory=/root" >> /etc/systemd/system/vncserver@.service
echo "PIDFile=/root/.vnc/%H:%i.pid" >> /etc/systemd/system/vncserver@.service
echo "ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1" >> /etc/systemd/system/vncserver@.service
echo "ExecStart=/usr/bin/vncserver -localhost no -depth 24 -geometry 1280x800 :%i" >> /etc/systemd/system/vncserver@.service
echo "ExecStop=/usr/bin/vncserver -kill :%i" >> /etc/systemd/system/vncserver@.service
echo "[Install]" >> /etc/systemd/system/vncserver@.service
echo "WantedBy=multi-user.target" >> /etc/systemd/system/vncserver@.service
systemctl daemon-reload
systemctl enable vncserver@1.service
# ----- End tightvnc install and setup
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment