Score:0

How to execute GUI app as superuser without entering password?

ph flag

I already edited sudoers file and sudo doesn't ask me for the password.

The problem is with Gnome that still displays the prompt.

Is there a way to leave the confirmation dialog, just remove the password thing? I'm not interested in paswordless login, password on login and after screen saver should stay, I just don't want to have to enter it every time I run a GUI app that requires "sudo".

BTW, it's pretty hard to search for this thing. I find either authentication on system (GUI) start, or sudo, this in Windows is called "UAC prompt", how is it called in Linux? I know the terms "privileges elevation", "run elevated" and such, but they are unrelated to, what I believe is a part of GNOME, right?

UPDATE: I tried creating a file /localauthority.conf.d/49-nopasswd.rules

polkit.addRule(function(action, subject) {
        if (subject.isInGroup("sudo")) {
                return polkit.Result.YES;
        }
});

It did nothing. I am in sudo group, but the password prompt appears as before. Of course I also did sudo service polkit restart.

noisefloor avatar
ec flag
In the specific case of synaptic, `sudo synaptic` is wrong anyway. If you need to call synaptic with root permissions, call `synaptic-pkexec`. This involves PolicyKit taken care of the necessary permissions. Despite that, the window prompting of the password will still appear. I think it is possible to get right of that setting permissions in PolicyKit. Which can be super tricky and openly speaking, I have very little experience doing that. But the take away here hopefully is: it is not `sudo` and the sudoers file only which takes care of permissions. PolicyKit is an important part, too.
starkus avatar
de flag
You could have a look here for collecting some information about PolicyKit and some possible configurations: https://wiki.archlinux.org/title/Polkit#Bypass_password_prompt
Harry avatar
ph flag
@starkus Look, I updated the question, I tried to use the documentation to create a bypass password rule, but it doesn't seem to work. I have slightly different directory structure in my system, but it's probably irrelevant, or is it?
Harry avatar
ph flag
@noisefloor Yes, I was using synaptic-pkexec. However "sudo synaptic" also works and doesn't even ask for the password ;) Why is it wrong to use `sudo` here?
noisefloor avatar
ec flag
Using `sudo` in combination with a GUI program can mess up your desktop / system if the worst comes to the worse. May not happen, but certainly can happen, as file ownerships and due to that permissions may be misset. pkexec is more advanced with regards to that and certainly should be used if the option is there - like for synaptic.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.