Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

Is there any difference between using sudo and using su -c? There are situations where one should be used but not the other?

I was previously using Ubuntu where sudo appears to be ubiquitous but now I'm giving Fedora 15 a try and the idiom su -c appears frequently when I'm trying to learn how to do a few things, although I still see sudo being used now and then.

share|improve this question
See also this question – Vorac Aug 11 '13 at 17:42
up vote 12 down vote accepted

The difference between sudo and su is how they perform authentication:

  • su prompts for the target user's password.
  • sudo checks whether the source user is authorized to run the command (the authorization is specified in /etc/sudoers). Depending on the configuration, it might prompt for the source user's password, both to mitigate the risk of an unattended console and to alert the user that privilege escalation is going on.

Once authorized, the effect is the same: run a command as root (or, if specified on the command line, as some other user).

There are further minor differences: they don't take the same options, and they don't set the environment for the command they run in exactly the same way. But for common usage, they're the same.

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.