LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Allow specific command to run without password (https://www.linuxquestions.org/questions/linux-security-4/allow-specific-command-to-run-without-password-4175656558/)

Domarius 06-28-2019 04:09 PM

Allow specific command to run without password
 
I have an app that runs on startup (protonmail-bridge, it allows me to use Protonmail with Thunderbird) but it asks for the password every single time...

I've found two variations on a theme, neither work;

Code:

User ALL=command, NOPASSWD: command
and
Code:

User ALL=(ALL) NOPASSWD: command

Currently I have

Code:

Domarius ALL=(ALL) NOPASSWD: protonmail-bridge
In either case, I get an error after CTRL+O and CTRL+X (save and quit), it says:
Code:

>>> /etc/sudoers: syntax error near line 29 <<<

BW-userx 06-28-2019 05:07 PM

it can get completed I guess,
Code:

PASSWD and NOPASSWD

    By default, sudo requires that a user authenticate him or herself before
running a command. This behavior can be modified via the NOPASSWD tag. Like a
Runas_Spec, the NOPASSWD tag sets a default for the commands that follow it in
the Cmnd_Spec_List. Conversely, the PASSWD tag can be used to reverse things.
For example:


    ray        rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
   
would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm as root on
the machine rushmore without authenticating himself. If we only want ray to be
able to run /bin/kill without a password the entry would be:


    ray        rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
       
Note, however, that the PASSWD tag has no effect on users who are in the group
specified by the exempt_group option.


By default, if the NOPASSWD tag is applied to any of the entries for a user on
the current host, he or she will be able to run “sudo -l” without a password.
Additionally, a user may only run “sudo -v” without a password if the NOPASSWD
tag is present for all a user's entries that pertain to the current host. This
behavior may be overridden via the verifypw and listpw options.

https://www.sudo.ws/man/sudoers.man.html

rknichols 06-28-2019 06:07 PM

Quote:

Originally Posted by Domarius (Post 6010092)
Currently I have

Code:

Domarius ALL=(ALL) NOPASSWD: protonmail-bridge
In either case, I get an error after CTRL+O and CTRL+X (save and quit), it says:
Code:

>>> /etc/sudoers: syntax error near line 29 <<<

You need the full path to the command, e.g.:
Code:

Domarius ALL=(ALL) NOPASSWD: /path/to/protonmail-bridge

Domarius 06-29-2019 04:05 PM

1 Attachment(s)
Quote:

Originally Posted by rknichols (Post 6010123)
You need the full path to the command, e.g.:
Code:

Domarius ALL=(ALL) NOPASSWD: /path/to/protonmail-bridge

Thanks :) I found the path to the executable with "whereis" and I saved the sudoers file without errors.

The problem is this didn't solve my original problem - the "keyring unlock" dialogue still shows up at startup when ProtonMail Bridge is enabled to startup with the OS.

Annoyingly, it seems there is no way in Linux to find out exactly WHAT program wants access when this happens (which seems like a very long running oversight). The only way I know Protonmail Bridge is the culprit is by turning off "Startup" in its own settings, and then the box stops appearing. And the only way I know "protonmail-bridge" is the executable is by trying a stab in the dark, typing "proton" on the command line, and using TAB for auto-complete, and found that it does indeed run when I type that from the command line. But who knows - maybe when it runs at startup it calls upon some other executable... I have no way of knowing...


All times are GMT -5. The time now is 12:00 AM.