[ALUG] sudo &

Huge huge at huge.org.uk
Thu Jun 8 12:28:15 BST 2017

On Thu, 2017-06-08 at 11:32 +0100, Mark Rogers wrote:
> Is there an easy was to launch a process with sudo and send it into
> the background?
> $ sudo myapp &
> .. will go straight into the background then stop, waiting for a
> password to be entered. So I have to bring it back to the foreground
> (fg), enter the password, stop it (ctrl-z) then send it back into the
> background (bg).
> Of-course what normally happens is that I don't realise it's stopped
> at all, only to come back several hours after a long process should
> have been running to find it hasn't yet started....
> I'm sure there's a better way?

This is what /etc/sudoers is for. You can add an entry that allows a
specific user to run a specific command as root without a password.

Be careful; If you're using this as a means to restrict access to root,
you have to make sure that there's no way a user can get a root shell,
by using a shell escape from the application, or replacing the binary
with a copy of a shell, for example.

Today is Prickle-Prickle, the 13th day of Confusion in the YOLD 3183
                  I don't have an attitude problem.
    If you have a problem with my attitude, that's your problem.

More information about the main mailing list