Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is it possible to start a program normally, and then later give it root or some other level of permission without restarting it?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

No. In general, a program can only reduce its privileges (although there are ways for root owned programs to temporarily drop privileges and regain them).

The current best practice for such programs is to separate the privileged and non-privileged portions into separate processes, and have the non-privileged process invoke the privileged one as needed (e.g. this is how the clock indicator's preferences panel lets you change the system time, or how the terminal updates the list of logged in users).

This needs to be part of the program's design though: if a program is not designed to act this way, then you'll need to run it under sudo or similar if it needs administrator privileges.

share|improve this answer

Yes. The software has to request it specifically though. PolicyKit is probably the best way.

Setuid also allows changing of privilege, but it's not a start as normal then go to root thing as much as a start as a service/drop/regain type of thing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.