Last active
November 20, 2018 04:06
-
-
Save quyenlv/bd1f85f1cd7749ba3483f7f0c621e04f to your computer and use it in GitHub Desktop.
Setup securely VNC through SSH tunnel
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
# Vncserver service file for Debian or Ubuntu with systemd | |
# | |
# Install vncserver | |
# apt-get install tightvncserver | |
# | |
# 1. Copy this file to /etc/systemd/system/vncserver@.service | |
# 2. Edit User= | |
# e.g "User=jo" | |
# 3. Edit the vncserver parameters appropriately in the ExecStart= line! | |
# e.g. the -localhost option only allows connections from localhost (or via ssh tunnels) | |
# 4. Run `systemctl daemon-reload` | |
# 5. Run `systemctl enable vncserver@:1.service` | |
# 6. Run `systemctl start vncserver@:1.service` | |
# | |
# Reference: | |
# * https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-16-04 | |
# * https://www.smarthomebeginner.com/setup-vnc-server-on-ubuntu-linux/ | |
# | |
[Unit] | |
Description=Start TightVNC server at startup | |
After=syslog.target network.target | |
[Service] | |
Type=forking | |
User=jo | |
PAMName=login | |
PIDFile=/home/jo/.vnc/%H:%i.pid | |
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1 | |
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x720 -alwaysshared -localhost -nolisten tcp :%i | |
ExecStop=/usr/bin/vncserver -kill :%i | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment