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.

How do I force an application to always require root permission?
For example, if I run nautilus, it should tell me permission denied and have me run it as root.
Is there a way to do this in Ubuntu? Force-require root permission?

share|improve this question
    
Already answered here. –  JMCF125 Sep 11 '13 at 11:16
add comment

1 Answer

up vote 1 down vote accepted

I would assume you would need to set the owner of the bin file (of the program) to be root, and make it executable only by the root.

So, as an example, this is the current permissions on my nautilus, which is located in /usr/bin/nautilus:

alaa@aa-UBUNTU:~$ ls -l /usr/bin | grep nautilus
-rwxr-xr-x 1 root   root       1542692 Feb 20 23:13 nautilus

In case you need to read more about permissions, click here. Also, before doing anything, remember the permissions of your program before you execute any commands, so that you can change back to those permissions should anything go wrong.

Notice that there are three "x"s, which means that the owner, group, and other (basically meaning everyone) have access to execute it. If we want the application to require root permission, we need to set it up so that the root is the only one able to execute it, hence we need to remove the "x"s (which is the executable permission) from "group" and "other", and only leave the first "x". To do this, you would do:

sudo chmod go-x /usr/bin/nautilus

This command means:

  • chmod: change mode/permissions
  • go: apply the following to "group" and "other"
  • -x: remove (because of the minus sign) the executable permission from "group" and "other"
  • /usr/bin/nautilus: the file to apply this to

So we are removing the "x" from "group" and "other". Now, the permissions looks like this:

alaa@aa-UBUNTU:~$ ls -l /usr/bin | grep nautilus
-rwxr--r-- 1 root   root       1542692 Feb 20 23:13 nautilus

If I try to run nautilus with my username, I get this:

alaa@aa-UBUNTU:~$ nautilus
bash: /usr/bin/nautilus: Permission denied

To be able to run nautilus, I would have to do sudo nautilus.

share|improve this answer
    
Thanks! I wish I had enough rep to vote it up... –  DarrenVortex May 9 '13 at 23:29
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.