fix(actions): never wait for a polkit prompt on remote reboot/shutdown

Without polkit permission (for example no active local session)
systemctl reboot/poweroff waited for an authentication dialog on the
controlled screen. Pass --no-ask-password so the action fails and is
logged instead. README: the viewer's terminal session list, reboot and
shutdown, and its Wayland window/clipboard were tested in a VM.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
VallierDevandClaude Opus 5.5 committed 2026-10-17 16:31:41 +08:00
1 parent 1b10a22c8c
commit 94fd3c2fa7
3 files changed
+14 -7

No files matched your search

+5 -3
View File
@@ -45,7 +45,7 @@
| Lock state and auto unlock | Lock state is reported to the viewer; with "auto unlock" enabled in the client, the password is verified with PAM and the session is unlocked |
| Lock after remote session | Stored on the host, so it still applies after reconnecting |
| Mute host while controlled | Host speakers are muted while the viewer still hears the sound; the previous mute state is restored afterwards |
| System actions | Lock, show desktop, task manager (system monitor), reboot, shut down |
| System actions | Lock, show desktop, task manager (system monitor), reboot, shut down (via `systemctl`; needs polkit permission for the user, usually an active local graphical session; without it the action fails and is logged, no password dialog appears on the host) |
| Port mapping | The official "port mapping" tool: forwards a local port on the viewer to an address reachable from the Linux host (e.g. 127.0.0.1:22); `UU_PORT_MAPPING=0` disables it |
| Reconnects | Every tool window has its own connection; they do not disturb each other |
| Headless servers | Goes online without a monitor with terminal, file transfer and port mapping; an Xvfb virtual desktop gives a full remote desktop (see below) |
@@ -435,7 +435,9 @@ terminal emulator (`TERMINAL` selects one). From source: `sudo apt install libsd
| Port mapping, terminal | — | — | ✅ |
| Clipboard (text, both ways), sound | — | — | ✅ (VM) |
| Remote assistance (ID + code) | — | — | ✅ (VM, guest host) |
| Terminal session list (create, double-click reattach, end) | — | — | ✅ (VM) |
| Reboot, shutdown | — | — | ✅ (VM) |
| Wayland desktop window and clipboard (Hyprland) | — | — | ✅ (VM) |
"—" = not tested yet. **Not tested live**: reboot/shutdown (only try on a machine you can restart), terminal session list
create/reattach, Wayland windows and clipboard, H.265 and 4:4:4 (only H.264 4:2:0 is decoded), multiple monitors. Logs carry field
"—" = not tested yet. Only use reboot/shutdown on machines you can restart. **Not tested live**: GNOME/KDE Wayland windows and clipboard, H.265 and 4:4:4 (only H.264 4:2:0 is decoded), multiple monitors. Logs carry field
numbers, sizes and states only, never keystrokes, clipboard or file contents, codes or credentials.
+5 -2
View File
@@ -41,7 +41,7 @@
| 锁屏与自动解锁 | 向控制端上报锁屏状态;开启「自动解锁被控端」后,通过 PAM 校验密码并解锁当前会话 |
| 远程结束后自动锁屏 | 设置保存在本机,重连后依然生效 |
| 被控端静音运行 | 主机扬声器静音,控制端照常能听到声音;结束后恢复原来的音量设置 |
| 系统操作 | 锁屏、显示桌面、任务管理器(系统监视器)、重启、关机 |
| 系统操作 | 锁屏、显示桌面、任务管理器(系统监视器)、重启、关机(通过 `systemctl`,需要当前用户有 polkit 权限:通常本机有活动的图形会话即可;没有权限时直接失败并记日志,不会在被控端弹出密码框) |
| 端口映射 | 官方「端口映射」工具:把控制端本地端口转发到 Linux 能访问到的地址(如 127.0.0.1:22);`UU_PORT_MAPPING=0` 可关闭 |
| 多次重连 | 每个工具窗口独立连接,互不影响 |
| 无头服务器 | 没有显示器也能上线,提供终端、文件传输和端口映射;也可以用 Xvfb 虚拟桌面提供完整远程桌面(见下文) |
@@ -399,6 +399,9 @@ xfce4-session xfce4-panel xfdesktop xfwm4 gnome-terminal`。
| 端口映射、终端 | — | — | ✅ |
| 剪贴板(文本,双向)、声音 | — | — | ✅(虚拟机) |
| 远程协助(ID + 验证码) | — | — | ✅(虚拟机,访客主机) |
| 终端会话列表(新建、双击接回、结束) | — | — | ✅(虚拟机) |
| 重启、关机 | — | — | ✅(虚拟机) |
| Wayland 下的桌面窗口与剪贴板(Hyprland) | — | — | ✅(虚拟机) |
「—」表示尚未测试。**未实测**:重启/关机(只应在可以重启的测试机上尝试)、终端会话列表的新建与接回、Wayland 下的窗口与剪贴板、
「—」表示尚未测试。重启/关机只应在可以重启的机器上使用。**未实测**:GNOME/KDE Wayland 下的窗口与剪贴板、
H.265 与 4:4:4(目前只解码 H.264 4:2:0)、多显示器。日志只记录字段号、大小和状态,不记录键盘、剪贴板、文件内容、验证码或凭据。
+4 -2
View File
@@ -61,6 +61,8 @@ fn save(settings: &Settings) {
#[derive(Default)]
pub struct PeerActions { started: AtomicBool }
/// Power actions pass --no-ask-password: without polkit permission (e.g. no active local session) systemctl
/// would otherwise wait for an authentication dialog on the controlled screen; fail and log instead.
fn quiet(program: &str, args: &[&str]) -> bool {
Command::new(program).args(args).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null())
.status().map(|s| s.success()).unwrap_or(false)
@@ -135,8 +137,8 @@ impl PeerActions {
let ok = detached("gnome-system-monitor", &[]) || detached("plasma-systemmonitor", &[]) || detached("xfce4-taskmanager", &[]);
log::info!("System action show_taskmgr: ok={}", ok); return false
}
REBOOT_SYSTEM => { log::warn!("System action reboot_system requested by viewer"); log::info!("reboot ok={}", quiet("systemctl", &["reboot"])); return false }
SHUTDOWN_SYSTEM => { log::warn!("System action shutdown_system requested by viewer"); log::info!("poweroff ok={}", quiet("systemctl", &["poweroff"])); return false }
REBOOT_SYSTEM => { log::warn!("System action reboot_system requested by viewer"); log::info!("reboot ok={}", quiet("systemctl", &["--no-ask-password", "reboot"])); return false }
SHUTDOWN_SYSTEM => { log::warn!("System action shutdown_system requested by viewer"); log::info!("poweroff ok={}", quiet("systemctl", &["--no-ask-password", "poweroff"])); return false }
_ => {}
}
let mut state = state().lock().unwrap();