From 9852b1f9877b49b87451d9b05b27edf16f7c3686 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Wed, 13 May 2026 16:46:59 +0800 Subject: [PATCH] fix: auto-set sudo password in file manager from host config --- src/backend/ssh/file-manager.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/ssh/file-manager.ts b/src/backend/ssh/file-manager.ts index 4bed2271..e05666bc 100644 --- a/src/backend/ssh/file-manager.ts +++ b/src/backend/ssh/file-manager.ts @@ -862,7 +862,7 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => { ); // Resolve credentials server-side when frontend doesn't provide them - let resolvedCredentials = { password, sshKey, keyPassword, authType }; + let resolvedCredentials = { password, sshKey, keyPassword, authType, sudoPassword: undefined as string | undefined }; if (hostId && userId && !password && !sshKey) { try { const { resolveHostById } = await import("./host-resolver.js"); @@ -873,6 +873,7 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => { sshKey: resolvedHost.key, keyPassword: resolvedHost.keyPassword, authType: resolvedHost.authType, + sudoPassword: resolvedHost.sudoPassword as string | undefined, }; connectionLogs.push( createConnectionLog( @@ -900,6 +901,7 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => { sshKey: resolvedHost.key, keyPassword: resolvedHost.keyPassword, authType: resolvedHost.authType, + sudoPassword: resolvedHost.sudoPassword as string | undefined, }; connectionLogs.push( createConnectionLog( @@ -1194,6 +1196,7 @@ app.post("/ssh/file_manager/ssh/connect", async (req, res) => { activeOperations: 0, channelOpener: new ChannelOpenSerializer(), userId, + sudoPassword: resolvedCredentials.sudoPassword, }; scheduleSessionCleanup(sessionId); res.json({