LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-28-2019, 04:09 PM   #1
Domarius
LQ Newbie
 
Registered: Apr 2019
Posts: 5

Rep: Reputation: Disabled
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 <<<
 
Old 06-28-2019, 05:07 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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

Last edited by BW-userx; 06-28-2019 at 05:08 PM.
 
Old 06-28-2019, 06:07 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by Domarius View Post
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
 
Old 06-29-2019, 04:05 PM   #4
Domarius
LQ Newbie
 
Registered: Apr 2019
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
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...
Attached Thumbnails
Click image for larger version

Name:	Unlock Keyring_067.png
Views:	14
Size:	16.5 KB
ID:	30815  
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How To Allow A Normal User To Run Commands As Root In Specific Directory In Linux LXer Syndicated Linux News 0 04-12-2018 01:33 AM
ip6tables - allow specific port number v6 traffic to specific machine psycroptic Linux - Networking 0 03-17-2015 08:45 AM
How do I allow only a specific ip with a specific mac on lan with iptables? tkmbe Linux - Networking 2 07-10-2012 05:20 PM
[SOLVED] How to run a program for a specific amount of time starting at a specific time? thiemster Linux - Newbie 12 05-18-2010 09:04 AM
iptables - drop all -> allow needed OR allow all -> drop specific lucastic Linux - Security 5 12-21-2004 02:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration