Closed znd4 closed 1 month ago
Hi @znd4,
A "short" update on this feature.
Since there is no native way to use the log viewer portion of PC
for input, I went in a slightly different direction.
I added is_elevated
flag to the process
type:
elevated_ls:
command: "ls -l /root"
is_elevated: true
shutdown:
signal: 9
The way I feed the password to an elevated process is through stdin
with something like sudo -S ls root
.
As long as an elevated process is running without a password, once it is selected in the TUI it will ask for a password using the command and search dialog:
And that works great and supports multiple retries, PC
even provides visual feedback if the password is wrong:
Unfortunately, this doesn't work for more than one process...
It's specific to sudo -S
and every other stdin
expecting process works fine.
It looks like a consequence of how the system handles sudo and privilege escalation. This is a security feature to prevent race conditions and ensure that privilege escalation is handled safely.
It took me so long to understand that it was not a bug in my code, but I didn't give up on this feature and I'm looking for workarounds.
Released in v1.9.0
I tried this in devenv with
{
processes = {
caddy.process-compose = {
# required to install its unique root certificate into the trust store
is_elevated = true;
};
};
}
It asks for my password but after entering it I get sudo: exec: command not found
Hi @RafaelKr,
Please open a new issue with steps to reproduce it.
Feature Request
Use Case:
I'd like to be able to manage processes that require elevated permissions (e.g.
kubectl port-forward 443:44
)Proposed Change:
Add an
admin
orsudo
flag. Whentrue
, run the configured command withsudo {rest of command}
in an embedded tty (so that user gets password retries).Who Benefits From The Change(s)?
Users who want to manage background processes with elevated permissions without elevating the entire
process-compose
process.Alternative Approaches
Prompt for an admin password and pipe it to
sudo
.