sudo won't work unless you've already set up an sudoers list

Story: Learn the Linux command lineTotal Replies: 3
Author Content
tracyanne

Jul 25, 2007
11:49 PM EDT
To use sudo do this:

sudo command you want to execute

You will be prompted for a password. You don't need the root password. Just type in your password and the command will be executed as root. Once the command is done you will be returned to your own login.

on my Mandriva system I get the following message

$ sudo drakconf $ tracy is not in the sudoers file. This incident will be reported
dinotrac

Jul 26, 2007
3:51 AM EDT
>You don't need the root password.

That depends on your configuration and your id. In Suse, for example, ordinary users must still provide the root password to use sudo to execute as root. In Ubuntu, I believe it is the same, except that users identified as having administrative authority (which, by default, includes the first user you set up) may gain root via their own password.

**Edit** That is the DEFAULT SuSE behavior. You can, of course, add users to /etc/sudoers.
jdixon

Jul 26, 2007
4:03 AM EDT
That's normal behavior on most systems. The default configuration for sudo is that root has to add each user she wants to grant sudo access to the /etc/sudoers file, and specify what programs that user is allowed to run.

My man page for sudo indicates that the default is now to expect the user's password, not root's, but I don't believe that used to be the case.
hkwint

Jul 29, 2007
1:53 PM EDT
For completeness sake, here's the conf-line that matters:

Quoting:Defaults rootpw


If that line is in /etc/sudoers, you need the root pw to sudo. If it's not in /etc/sudoers, or it's commented out, you need the password of the user you are logged in with at that moment.

You can also enable a user to do some stuff without a passwd:
Quoting: Cmnd_Alias BACKUP = /usr/bin/flexbackup, /home/kwint/bin/flexbu .... ....

kwint ALL = NOPASSWD: BACKUP


This means that user 'kwint' may do, on ALL hosts (that's only 'localhost' in this case, my own PC), without a passwd, the actions that are in the Cmnd_Alias 'group' BACKUP. It is nice to make Cmnd_Aliases to group commands which are almost the same.

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!