Allow unattended Linux RustDesk connections

This commit is contained in:
2026-09-08 09:46:30 -06:00
parent db395c9215
commit bb6bcf3e85
@@ -178,6 +178,7 @@ custom-rendezvous-server = '${RUSTDESK_SERVER_ADDRESS}:21116'
relay-server = '${RUSTDESK_SERVER_ADDRESS}:21117' relay-server = '${RUSTDESK_SERVER_ADDRESS}:21117'
key = '${RUSTDESK_SERVER_PUBLIC_KEY}' key = '${RUSTDESK_SERVER_PUBLIC_KEY}'
verification-method = 'use-permanent-password' verification-method = 'use-permanent-password'
approve-mode = 'password'
EOF EOF
) )
@@ -215,6 +216,7 @@ set_access_password() {
rustdesk --password "$ACCESS_PASSWORD" >/dev/null rustdesk --password "$ACCESS_PASSWORD" >/dev/null
rustdesk --option verification-method use-permanent-password >/dev/null rustdesk --option verification-method use-permanent-password >/dev/null
rustdesk --option approve-mode password >/dev/null
if id lightdm >/dev/null 2>&1; then if id lightdm >/dev/null 2>&1; then
local lightdm_uid local lightdm_uid
lightdm_uid=$(id -u lightdm) lightdm_uid=$(id -u lightdm)
@@ -226,6 +228,10 @@ set_access_password() {
XDG_CONFIG_HOME=/var/lib/lightdm/.config \ XDG_CONFIG_HOME=/var/lib/lightdm/.config \
XDG_RUNTIME_DIR="/run/user/${lightdm_uid}" \ XDG_RUNTIME_DIR="/run/user/${lightdm_uid}" \
/usr/share/rustdesk/rustdesk --option verification-method use-permanent-password >/dev/null /usr/share/rustdesk/rustdesk --option verification-method use-permanent-password >/dev/null
runuser -u lightdm -- env HOME=/var/lib/lightdm \
XDG_CONFIG_HOME=/var/lib/lightdm/.config \
XDG_RUNTIME_DIR="/run/user/${lightdm_uid}" \
/usr/share/rustdesk/rustdesk --option approve-mode password >/dev/null
fi fi
systemctl restart rustdesk systemctl restart rustdesk
systemctl is-active --quiet rustdesk || fail 'The RustDesk service did not restart after setting its permanent password.' systemctl is-active --quiet rustdesk || fail 'The RustDesk service did not restart after setting its permanent password.'