Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-18-2011, 11:13 PM   #1
Registered: Feb 2008
Location: China-Shanghai
Distribution: Rhel&Suse
Posts: 82

Rep: Reputation: 15
su -c & sudo


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

Could you please give me some examples in details ?

Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-18-2011, 11:36 PM   #2
Registered: Sep 2009
Location: Maryland
Distribution: Slackware
Posts: 68

Rep: Reputation: 29
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.
2 members found this post helpful.
Old 09-19-2011, 01:36 AM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,575

Rep: Reputation: 2427Reputation: 2427Reputation: 2427Reputation: 2427Reputation: 2427Reputation: 2427Reputation: 2427Reputation: 2427Reputation: 2427Reputation: 2427Reputation: 2427
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
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Ultimate Sudo FAQ To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 02:36 AM
su & sudo -i jone kim Linux - General 2 05-31-2010 05:33 PM
sudo apt-get update && sudo apt-get upgrade hallve_revera Linux - Newbie 6 01-10-2009 10:37 AM
openbox & sudo hungrigerhaifisch Ubuntu 10 10-07-2005 06:22 AM
SUDO & Perl mclard Programming 1 12-02-2004 01:56 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration