Created
November 24, 2022 02:42
-
-
Save mjtiempo/8662e88da74236c58115bed5cc78ceaf to your computer and use it in GitHub Desktop.
TigerVNC systemd service using sddm on kde plasma
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
[Unit] | |
Description=Remote desktop service (VNC) for :0 display | |
Requires=display-manager.service | |
After=network-online.target | |
After=display-manager.service | |
[Service] | |
Type=simple | |
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment XAUTHORITY=$(find /var/run/sddm/ -type f)" | |
Environment=HOME=/root | |
ExecStart=x0vncserver -display :0 -rfbauth /root/.vnc/passwd | |
Restart=on-failure | |
RestartSec=500ms | |
[Install] | |
WantedBy=multi-user.target |
May require a bit of sleep to get the service to start on some systems:
ExecStart=/usr/bin/bash -c '/usr/bin/sleep 3 && /usr/bin/x0vncserver -display :0 -rfbport 5904 -passwordfile /root/.vnc/passwd &'
Might be able to add it to ExecStartPre
instead, but I haven't tested:
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment XAUTHORITY=$(find /var/run/sddm/ -type f) && sleep 3"
Or on its own ExecStartPre
, after the first one; also untested:
ExecStartPre=/usr/bin/bash -c "/usr/bin/sleep 3"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think that @toneoesa made a typo... It is the
-fg
switch for foreground mode that seems to be required.If you want to connect from another system, you probably also want to add
localhost -no
: