Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an application that needs to run with root permissions.

Using setuid bit on the application file seems like a logical choice. My understanding of setuid is that the files should be owned by root, and only be writable by root, or otherwise an untrusted user with write permissions could edit the file, and execute anything in root context.

However, this complicates deploying the application, since I need to set the files owner to be root after it is deployed (pulled down from remote Git repo), something like:

 sudo chown root:root /app/rootprog
 sudo chmod 6711 /app/rootprog

Is there a way to avoid this, or a better way to develop and deploy an application that has to run as root?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

An application that has to run as root must be installed by an administrator with root access. This can be done using privilege escalation (e.g. via sudoor equivalent).

The best way to deploy the application depends on several factors but is probably best done by means of the distribution's primary package manager. This might mean providing an RPM file for download or it might mean adding a package to an Internet-accessible repository.

share|improve this answer
add comment

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.