LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Rep: Reputation: 15
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.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-18-2011, 10:36 PM   #2
kforbus
Member
 
Registered: Sep 2009
Location: Maryland
Distribution: Slackware
Posts: 68

Rep: Reputation: 28
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, 12:36 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

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


Reply


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 01:36 AM
su & sudo -i jone kim Linux - General 2 05-31-2010 04:33 PM
sudo apt-get update && sudo apt-get upgrade hallve_revera Linux - Newbie 6 01-10-2009 09:37 AM
openbox & sudo hungrigerhaifisch Ubuntu 10 10-07-2005 05:22 AM
SUDO & Perl mclard Programming 1 12-02-2004 12:56 PM


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

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