You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vncserver@.service.in 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # The vncserver service unit file
  2. #
  3. # Quick HowTo:
  4. # 1. Copy this file to /etc/systemd/system/vncserver@.service
  5. # 2. Edit <USER> and vncserver parameters appropriately
  6. # ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2")
  7. # 3. Run `systemctl daemon-reload`
  8. # 4. Run `systemctl enable vncserver@:<display>.service`
  9. #
  10. # DO NOT RUN THIS SERVICE if your local area network is
  11. # untrusted! For a secure way of using VNC, you should
  12. # limit connections to the local host and then tunnel from
  13. # the machine you want to view VNC on (host A) to the machine
  14. # whose VNC output you want to view (host B)
  15. #
  16. # [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
  17. #
  18. # this will open a connection on port 590N of your hostA to hostB's port 590M
  19. # (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
  20. # See the ssh man page for details on port forwarding)
  21. #
  22. # You can then point a VNC client on hostA at vncdisplay N of localhost and with
  23. # the help of ssh, you end up seeing what hostB makes available on port 590M
  24. #
  25. # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
  26. #
  27. # Use "-localhost" to prevent remote VNC clients connecting except when
  28. # doing so through a secure tunnel. See the "-via" option in the
  29. # `man vncviewer' manual page.
  30. [Unit]
  31. Description=Remote desktop service (VNC)
  32. After=syslog.target network.target
  33. [Service]
  34. Type=forking
  35. # Clean any existing files in /tmp/.X11-unix environment
  36. ExecStartPre=/bin/sh -c '@BIN_DIR@/vncserver -kill %i > /dev/null 2>&1 || :'
  37. ExecStart=/usr/sbin/runuser -l <USER> -c "@BIN_DIR@/vncserver %i"
  38. PIDFile=/home/<USER>/.vnc/%H%i.pid
  39. ExecStop=/bin/sh -c '@BIN_DIR@/vncserver -kill %i > /dev/null 2>&1 || :'
  40. [Install]
  41. WantedBy=multi-user.target