LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   su -c & sudo (https://www.linuxquestions.org/questions/linux-newbie-8/su-c-and-sudo-903756/)

jcky 09-18-2011 10:13 PM

su -c & sudo
 
Hi,

Is there any difference between 'su -c passwd' and 'sudo passwd' ?

Could you please give me some examples in details ?

Thx.

kforbus 09-18-2011 10:36 PM

Well, both commands would result in the changing of the password for the superuser account. "su -c passwd" would run the passwd command in the context of the root user and then drop back down to your normal user context. The sudo command would pretty much do the same thing. In my opinion, sudo is what you would want to use if you were delegating admin duties to another user. Then they would be prompted to type their own password to issue the command instead of the root password that you would be prompted for with the su command. Of course, my observations are at a very high view. Someone else with deeper knowledge would have to explain the details of exactly what is functionally different between su and sudo, if that's what you're looking for.

chrism01 09-19-2011 12:36 AM

I'd say that's a good enough explanation, especially if this is just a general enquiry/homework.
For a more in depth answer, we'd want to know exactly what you are using this info for, if anything.
See also
http://linux.die.net/man/1/su
http://linux.die.net/man/8/sudo


All times are GMT -5. The time now is 08:13 PM.