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

How is it possible for sudo to actually function? If it's just a normal program, couldn't you make the same thing without requiring the user to authenticate, giving anyone with access to a computer automatic root access? And how can it do things as root without root's password?

share|improve this question
up vote 9 down vote accepted

TL;DR: Sudo has a special flag

Sudo has the set uid bit set as you can see here:

ls -l `which sudo`
-rwsr-xr-x 2 root root 127668 2013-02-27 21:41 /usr/bin/sudo

Setting the suid bit for a file means what the program gets run with the effective uid or the suid-ed user. And in this this case user root has uid 0, granting it elevated permissions.

share|improve this answer

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.