Blame SOURCES/vncserver-system.service

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