Launching a program by start that needs «sudo» password

New to SolydXK? This is the place to start.
Please check the other subforums to see if there's a more suitable place for your question.
User avatar
amnesix
Posts: 94
Joined: 09 Nov 2013 12:46
Location: Berlin (Allemagne)
Contact:

Launching a program by start that needs «sudo» password

Postby amnesix » 30 Jan 2018 12:06

Hi there,

I run SolydX. And I use a VPN (Airvpn). I would like to be able to launch my VPN at start, but without to have to type my password. I know.

How should I do this ?

User avatar
wildman
Posts: 230
Joined: 12 Feb 2014 23:31
Location: Kentucky, USA

Re: Launching a program by start that needs «sudo» password

Postby wildman » 30 Jan 2018 17:34

You will need to edit /etc/sudoers by using visudo. Open a terminal and enter this:

Code: Select all

sudo visudo
Scroll down to the bottom and add this line:

Code: Select all

user ALL=NOPASSWD: /path/to/Airvpn
Replace 'user' with your user name and replace '/path/to/Airvpn' with the complete path to the program. This should allow the program to run without asking for a password.

CAUTION! Always use visudo when editing sudoers. Never use a text editor.
Wildman
May the Source be with you.

User avatar
amnesix
Posts: 94
Joined: 09 Nov 2013 12:46
Location: Berlin (Allemagne)
Contact:

Re: Launching a program by start that needs «sudo» password

Postby amnesix » 30 Jan 2018 17:46

Thank you for your answer !

I had tried that already, but it does not work.

CAUTION! Always use visudo when editing sudoers. Never use a text editor.


Can you explain me why ? And could the fact that when I first tried I did it using a text editor cause the unsuccess ?

User avatar
ScottQuier
Posts: 1769
Joined: 18 Jul 2013 15:55
Location: Newport News, VA

Re: Launching a program by start that needs «sudo» password

Postby ScottQuier » 30 Jan 2018 18:14

amnesix wrote:
CAUTION! Always use visudo when editing sudoers. Never use a text editor.


Can you explain me why ? And could the fact that when I first tried I did it using a text editor cause the unsuccess ?

I second the question. I would have thought that using vi/vim as root in a terminal window would have generated no issues. Am I wrong?
Scott
Quoting zerozero, "The usage of PPA's in debian-based
systems is risky at best and entails serious compatibility
problems; usually it's the best way to destroy an install"

User avatar
wildman
Posts: 230
Joined: 12 Feb 2014 23:31
Location: Kentucky, USA

Re: Launching a program by start that needs «sudo» password

Postby wildman » 30 Jan 2018 18:49

Scott, every web page I have read concerning sudoers cautioned against using a text editor. Don't know why. As to your second question, I can't answer it either. Never tried it. I have always heeded the caution and used visudo.
Wildman
May the Source be with you.

User avatar
smitty1
Posts: 233
Joined: 23 Jun 2013 13:50
Location: Pittsburgh, PA USA

Re: Launching a program by start that needs «sudo» password

Postby smitty1 » 31 Jan 2018 17:08

I have been curious about this myself, so this morning I investigated.
The man page for visudo states that it provides some "sanity checking" when editing the sudoers file. This sounded like some syntax checking so I did a small test.
In a graphical text editor, opened with elevated privileges I removed the # from the comment near the end about including the /etc/sudoers.d directory, saved the file, opened a terminal and tried sudo su. This caused an error parsing file.
After rebooting and copying to original sudoers file back I tried the same edit using visudo. When I tried to save and close I got the same error but with options to edit again, abandon changes, or keep changes.
While it isn't necessary to use visudo, it is advantageous.

No Good Deed Goes Unpunished


Return to “Newbie Questions”

Who is online

Users browsing this forum: No registered users and 1 guest