Skip to content

Instantly share code, notes, and snippets.

@gautiermichelin
Last active May 13, 2016 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gautiermichelin/31653b26294d7345c200a0e8afcd5141 to your computer and use it in GitHub Desktop.
Save gautiermichelin/31653b26294d7345c200a0e8afcd5141 to your computer and use it in GitHub Desktop.
Install VNC as a service under Ubuntu 16.04 (need to be run as root)
# ##################################################################
# Script Name : vnc-install.sh
# Description : Perform an automated install of X11Vnc
# Configure it to run at startup of the machine
# Date : May 2016
# Gautier Michelin, idéesculture
# Based on : Griffon, http://www.c-nergy.be - http://www.c-nergy.be/blog
# #################################################################
# Step 1 - Install X11VNC
# #################################################################
apt-get install x11vnc -y
# Step 2 - Specify Password to be used for VNC Connection
# #################################################################
x11vnc -storepasswd /etc/x11vnc.pass
# Step 3 - Create the Service Unit File
# #################################################################
cat > /lib/systemd/system/x11vnc.service << EOF
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
EOF
# Step 4 -Configure the Service
# ################################################################
echo "Configure Services"
systemctl enable x11vnc.service
systemctl daemon-reload
sleep 10
# Step 5 - Remember to restart system
# ################################################################
@gautiermichelin
Copy link
Author

Install :

wget https://gist.githubusercontent.com/gautiermichelin/31653b26294d7345c200a0e8afcd5141/raw/e7d945830742f8dbd9708bde30b1ea65e7845d17/vnc-install.sh && chmod +x vnc-install.sh && ./vnc-install.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment