Linux – Grant root permissions to application, so won’t prompt again

linuxroot

In startos (with the ypkg packages), their app store somehow can download and install packages, without the prompt of any root or user password, to the root protected folders of /usr …etc. However their command line program (using same package format) requires my password (I am a sudoer though).

My questions:
Is there any way to do this with the ubuntu software center?
How does this work? (allow a program root access without password from user)

Best Answer

Turn on the Set User ID (SUID) bit on the program:

sudo chmod u+s /usr/bin/software-center

Every time this program starts, it has the privilege of the owner (owner should be root to gain root powers). Any child processes that the program forks() will inherit the root privileges. This won't work however if the prompting of the password does not depend on the effective user id of the program (i.e. it's been programmed to always prompt).

Related Question