feat: add sudo support for file manager operations #509

Merged
ZacharyZcR merged 1 commits from feat/file-manager-sudo-support into dev-1.10.1 2026-01-14 20:54:21 +00:00
ZacharyZcR commented 2026-01-14 17:35:37 +00:00 (Migrated from github.com)

Summary

  • Add sudo password dialog when file operations encounter permission denied errors
  • Sudo password is temporarily stored in SSH session memory (cleared on disconnect)
  • Currently supports delete operation with sudo retry (other operations can be added similarly)

Changes

  • Backend: Add sudoPassword field to SSH session, execWithSudo helper function, /sudo-password endpoint
  • Backend: Modify delete operation to auto-retry with sudo when password is set
  • Frontend: Add SudoPasswordDialog component for password input
  • Frontend: Modify FileManager.tsx to detect needsSudo response and show dialog
  • i18n: Add translation keys for sudo dialog

Security

  • Password stored only in memory, never persisted to database
  • Automatically cleared when SSH session disconnects
  • Uses sudo -S to pass password via stdin (not exposed in command line)

Test Plan

  • Delete a file in /etc or other protected directory as non-root user
  • Permission denied triggers sudo password dialog
  • After entering correct password, operation succeeds
  • Same session reuses sudo password for subsequent operations
## Summary - Add sudo password dialog when file operations encounter permission denied errors - Sudo password is temporarily stored in SSH session memory (cleared on disconnect) - Currently supports delete operation with sudo retry (other operations can be added similarly) ## Changes - **Backend**: Add `sudoPassword` field to SSH session, `execWithSudo` helper function, `/sudo-password` endpoint - **Backend**: Modify delete operation to auto-retry with sudo when password is set - **Frontend**: Add `SudoPasswordDialog` component for password input - **Frontend**: Modify `FileManager.tsx` to detect `needsSudo` response and show dialog - **i18n**: Add translation keys for sudo dialog ## Security - Password stored only in memory, never persisted to database - Automatically cleared when SSH session disconnects - Uses `sudo -S` to pass password via stdin (not exposed in command line) ## Test Plan - [ ] Delete a file in `/etc` or other protected directory as non-root user - [ ] Permission denied triggers sudo password dialog - [ ] After entering correct password, operation succeeds - [ ] Same session reuses sudo password for subsequent operations
Sign in to join this conversation.