<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 3 Jun 2022 at 08:14, Bruce Steers <<a href="mailto:bsteers4@gmail.com">bsteers4@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-size:small">Is there ANY possible way to get a gambas program to raise it's su privilages after launch?</div><div style="font-size:small"><br></div><div style="font-size:small">I have a program doing some copy/move/delete commands that may or may not be in root only accessible locations.</div><div style="font-size:small"><br></div><div style="font-size:small">I don't want to force the app to be run as root but would be handy if it could get su privileges once run if needed.</div><div style="font-size:small"><br></div><div style="font-size:small">My currently used option is to gather any commands that need to be run as root into a temporary bash script then run the script via Desktop.RunAsRoot (pkexec)Â but this will ask for password each time i run a command, <br></div><div style="font-size:small"><br></div><div style="font-size:small">Option i'm working on (it's a bit hacky but it works)..</div><div style="font-size:small">I have a hidden TerminalView object that runs bash through pkexec so a one time password request activates the hidden su bash terminal and then I can run commands through it at will without having to authorize again.</div><div style="font-size:small"><br></div><div style="font-size:small">Problems are output text comes with all the terminal escape chars/codes and needs filtering and i'm limited to only using shell commands not gambas internal ones.<br></div><div style="font-size:small"><br></div><div style="font-size:small">anyone ever worked on having a gambas app raise it's privileges?</div><div style="font-size:small">Ideally i'd like to up the level then use gambas internal copy/move methods rather than shell commands.</div><div style="font-size:small"><br></div><div style="font-size:small">Respects</div><div style="font-size:small">BruceS</div></div></blockquote><div><br></div><div style="font-size:small" class="gmail_default">Attached is a rough tester for what i have so far. it's simply a textbox with some buttons and a textarea. enter the command you want to run in the textbox and press a button to run it, output goes in the textarea<br></div><div style="font-size:small" class="gmail_default">you can run a command as root and it will ask for password, then running further commands does not as it goes through the hidden TerminalView with superuser bash.</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">Anyone got a better solution?</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">Respects</div><div style="font-size:small" class="gmail_default">BruceS</div><div style="font-size:small" class="gmail_default"><br></div></div></div>