Blame SOURCES/vncserver-system.service

64a8b7
# The vncserver service unit file
64a8b7
#
64a8b7
# Quick HowTo:
64a8b7
# 1. Copy this file to /etc/systemd/system/vncserver@.service
64a8b7
# 2. Replace <USER> with the actual user name and edit vncserver
64a8b7
#    parameters in the wrapper script located in /usr/bin/vncserver_wrapper
64a8b7
# 3. Run `systemctl daemon-reload`
64a8b7
# 4. Run `systemctl enable vncserver@:<display>.service`
64a8b7
#
64a8b7
# DO NOT RUN THIS SERVICE if your local area network is
64a8b7
# untrusted!  For a secure way of using VNC, you should
64a8b7
# limit connections to the local host and then tunnel from
64a8b7
# the machine you want to view VNC on (host A) to the machine
64a8b7
# whose VNC output you want to view (host B)
64a8b7
#
64a8b7
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
64a8b7
#
64a8b7
# this will open a connection on port 590N of your hostA to hostB's port 590M
64a8b7
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
64a8b7
# See the ssh man page for details on port forwarding)
64a8b7
#
64a8b7
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
64a8b7
# the help of ssh, you end up seeing what hostB makes available on port 590M
64a8b7
#
64a8b7
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
64a8b7
#
64a8b7
# Use "-localhost" to prevent remote VNC clients connecting except when
64a8b7
# doing so through a secure tunnel.  See the "-via" option in the
64a8b7
# `man vncviewer' manual page.
64a8b7
64a8b7
64a8b7
[Unit]
64a8b7
Description=Remote desktop service (VNC)
64a8b7
After=syslog.target network.target
64a8b7
64a8b7
[Service]
64a8b7
Type=simple
64a8b7
64a8b7
# Clean any existing files in /tmp/.X11-unix environment
64a8b7
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
64a8b7
ExecStart=/usr/bin/vncserver_wrapper <USER> %i
64a8b7
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
64a8b7
64a8b7
[Install]
64a8b7
WantedBy=multi-user.target