mvadkert / rpms / tigervnc

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