0

Let's say I wanted an automated script to start right after a login prompt. The script, however, needs a user password before it can be executed manually using sudo 'script' command from the terminal.

Now, I suppose I could write a script with the needed password and just set it up as one of the startup apps but the thing is I'm trying to avoid putting any sensitive information inside it. And for now, I want this to be an isolated case.

I'm certain there are workarounds but I'm new to Ubuntu, so any help will be most appreciated.

EDIT: I have tried that. I created a new file in /etc/sudoers.d/ and set the overrides there.

The following line seems to be working just fine:

user ALL = NOPASSWD : ALL

Problem appears when I try setting it up for a specific script:

user ALL = NOPASSWD : /home/user/script

Also tried:

user host = (root) NOPASSWD : /home/user/script

as well as some of the other combinations but nothing works. I'm using Ubuntu 16.04 LTS.

Inside the script there is a simple sudo command and if I run bash 'script', it always asks me for a user password except in the first example but that's exactly what I'm trying to avoid. I only want override for this script.

I have also changed permissions on the sudoers.d/override file as directed in this post.

So I have no idea why it won't work...

0 Answers0