1

I'm using Ubuntu Mate for my raspy. I'm using my raspy to run a program 24/7, which requires to be started with sudo.

Because I don't want to do this manually, I added a script to "startup applications"... the problem is that "startup applications" get executed as raspy (my default user).

So, I decided to fix this with visudo . I added following entry: raspy ALL= (root) NOPASSWD: /usr/bin/myscript.sh and rebooted. Nothing changed- sudo sh /usr/bin/myscript.sh still requires a password.

After that I tried a bit around [modifying this line, verifying its syntax always by visudo -c...].. I got this work:

raspy ALL = (raspy) NOPASSWD: /usr/bin/myscript.sh

which allows me to start the script as raspy without having to enter password.

The file owner is root, file owning group is root, permissions are 700 .

What have I to insert in Visudo, that I can execute my script as root ( with this sudo sh /usr/bin/myscript.sh ) without having to enter a password?

11
  • As a guess: sudo sh /usr/bin/myscript.sh runs sh as root, which your sudoers line did not allow. Try running it without the sh
    – ssta
    Nov 8, 2015 at 12:55
  • Alternatively, if you want to run something at boot, then an easy and convenient way to do this is with crontab using the @reboot directive. Put it in the system crontab and it will run as root (which appears to be what you want)
    – ssta
    Nov 8, 2015 at 12:57
  • sudo /usr/bin/myscript.sh still asks for a password
    – leAthlon
    Nov 8, 2015 at 12:57
  • @ssta , the program I need to start has to be executed after login, with an approtiate delay (that the GUI started fully)
    – leAthlon
    Nov 8, 2015 at 12:58
  • What exactly is the script? Maybe it requires mono?
    – iamatrain
    Nov 8, 2015 at 13:11

0

You must log in to answer this question.

Browse other questions tagged .