I have got a program which to start needs to be started with sudo, but as it would be very useful for this program to start up at startup without me having to manually start it, is there a way to get a program to start up at start up that would need to have sudo before it and then an admin password given to run it? And is there any way of doing this without causing a security risk?

OS Information:

Description:    Ubuntu 14.10
Release:    14.10
  • If it is important (or preferable) for you not to edit the sudoers file, there is an other option (from the "trickery and deceit" department) to run an application after log- in from root. Let me know and I'll post it. – Jacob Vlijm Apr 4 '15 at 21:01
  • @JacobVlijm I'm curious, what is it ? – MoonSweep Apr 5 '15 at 10:28
  • @MoonSweep: What is what? The application that I want to run? – user364819 Apr 5 '15 at 10:29
  • No, the root trick. – MoonSweep Apr 5 '15 at 10:29
  • @Moonsweep it is a bit of a dirty trick, and it depends on the situation if it fits. I remember having it posted some time ago (although I would rethink the concept a bit if I would write it now): askubuntu.com/a/486304/72216 I am curious however what is the application (Torodial). – Jacob Vlijm Apr 5 '15 at 11:47

I think it's not possible without configuring sudo to let the user launch the program without a password (through /etc/sudoers and the NOPASSWD option), which can be considered like a more or less important security risk depending on the program involved.

The best that can be done is to instruct sudo to restrict this to a single user, and only for that particular program, with a line like:

my_user ALL = (root:root) NOPASSWD: /path/to/my_program

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy