Don't pass sudo password, all commands should be in sudoers

This commit is contained in:
Valeriy Manzhos 2026-04-08 15:34:50 +03:00
parent ce4793cc91
commit f86e876242
No known key found for this signature in database
GPG key ID: 6547CFC8E2EC3D90

View file

@ -34,7 +34,7 @@ public class CoreAdminManager
StringBuilder sb = new();
sb.AppendLine("#!/bin/bash");
var cmdLine = $"{fileName.AppendQuotes()} {string.Format(coreInfo.Arguments, Utils.GetBinConfigPath(configPath).AppendQuotes())}";
sb.AppendLine($"exec sudo -u#{UID.ToString()} -S -- {cmdLine}");
sb.AppendLine($"exec sudo -u#{UID.ToString()} -- {cmdLine}");
var shFilePath = await FileUtils.CreateLinuxShellFile("run_as_sudo.sh", sb.ToString(), true);
Dictionary<string,string> env = new Dictionary<string, string>();
env.Add("ENABLE_DEPRECATED_LEGACY_DNS_SERVERS", "true");
@ -43,7 +43,7 @@ public class CoreAdminManager
arguments: "",
workingDirectory: Utils.GetBinConfigPath(),
displayLog: true,
redirectInput: true,
redirectInput: false,
environmentVars: env,
updateFunc: _updateFunc
);