Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have noticed that in all Linux systemsArchLinux*, certain setuid programs come with rather unusual permissions:

-r-sr-xr-x  root  root  /bin/su*
---s--x--x  root  root  /usr/bin/sudo*

The question is, why is the sudo binary set to be only readable to root? What's the point of that? Why can't it be like su?

Edit: After reinstalling sudo, it doesn't have read/write either.

(* I could've sworn I have seen the same in Debian. Apparently not.)

share|improve this question

The first question that sprang to my mind is Why does sudo have write permission for root?

Broadly, suid programs are pretty dangerous and you should grant them as few privileges as possible. You can't get much more restrictive than only execute permission!

If you can read a file, you can disassemble it. And if you can disassemble it you can look for security flaws and make it that little bit easier to discover attack vectors.

sudo is a little more vulnerable to attack than su as you don't always need to supply a password to have privileged access to some resources (depending on how it's set up). This may warrant tighter security.

share|improve this answer
And if you can compile it on your own? Won't that make it even easier? – grawity Nov 9 '09 at 14:17
It's just an extra hurdle that a would-be attacked would have to jump. It's not enough on its own but as an extra layer of protection it might be worth it. – Stephen Darlington Nov 9 '09 at 15:05

On my machine, Ubuntu 9.04, there is no difference in the permissions.

-rwsr-xr-x 2 root root /usr/bin/sudo
-rwsr-xr-x 1 root root /bin/su

On your machine, it might have been made not readable in an attempt to keep people from using it? Might it have gotten edited somehow? There is no reason for the permissions on the 2 files to be different. On Ubuntu, the root account is locked - you can't login as root anyways (unless you take actions to enable it obviously).

Maybe there are OS differences here. What OS are you using in your example?

share|improve this answer
Checked it again, and it seems to only happen in Arch Linux. (In fact, after reinstalling the sudo package, its binary only has execute and setuid permissions (0411), no read at all.) – grawity Nov 9 '09 at 13:05
The Makefile from original source package from does install sudo as 4111 too. – grawity Nov 9 '09 at 13:11
The sudo FAQ says the permissions on sudo (should be) "something like chmod 4111 /usr/local/bin/sudo". I'm having trouble finding the equivalent information fo su. Is it possible that the difference is merely historic as the two binaries have two different groups of developers? – DaveParillo Nov 9 '09 at 17:03

I question your premise. Why should sudo be like su?

su only grants privs if you (a) already have them or (b) authenticate to get them.

sudo grants privs based on a rulebase; it can be told, for example, to grant root privs to 'joe' any time joe asks, with no password needed. "man sudoers" - its quite powerful.

So sudo has the capability to do things su can't do.

One could stomp on the sudo executable in such a way as to make it always grant root to anyone who asked - ignoring the sudoers file and just using an internal "hardwiring" of sorts.

So it makes sense to protect it MORE than we need to protect su; it makes sense to make it very hard to read or write to the sudo executable itself.

share|improve this answer
The question was about read permission, not write. – grawity Nov 11 '09 at 18:00
Step one of creating a "stomp" is reading the executable so you can learn how it works, and where you can stomp. Thus I've ammended my answer. – pbr Nov 12 '09 at 15:29

Your Answer


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.