[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: permissions/sudo/sudoers



John Lindsay wrote:
> If I try 'sudo' in a terminal window, it asks for my password. If I
> try 'root's' password I get 'user not in sudoers file'.

It asks for your password.  If you give it root's password then it
should fail since root's password is different from your password.

> If I try my user password I get 'user not in sudoers file. this
> incident will be reported.'

Your account is not configured.

> I'm trying to run 'sudo apt-get install mono-complete monodevelop'
> in a terminal shell so I can a SDR dongle working under linux. I am
> trying to follow the commands from 'rtlsdr.org/softwarelinux.

Many documents will say use 'sudo this' or 'sudo that' saying 'sudo'
there to document that the command needs root permissions.  I often do
that myself.  In reality it doesn't matter how you get root
permissions.  You can su to root.  In which case if you are root then
you don't need to use sudo.

> If I run them under a root terminal it seems to work without asking
> for my password.

Because it would be silly if the superuser needed permissions the root
user is configured to work by default.  Therefore sudo doesn't ask for
a password when it is run by root.

Again, if you are root then you don't need sudo since all that sudo
does is elevate your process privilege to root and you are already
there.

> I think all this should be done as a user not as a superuser since I
> as the user want to play around with this dongle.

Normally (traditionally) users gain access by being in a group.  There
are groups for everything.  But recently there are other ways of
making things available through consolekit/policykit.  I don't know
much about them and others will need to jump in to help with them.

> How do I add 'user' to the sudoers file so it doesn't complain all the time.
> I am not a command line guru -- I don't have a great understanding
> of all the commands so I need some direction.

If sudo is installed at debian-installer time then the installer will
set it up for the install user.  If sudo is installed after that time
or for additional users then those additional users will need to be
configured.  You must have installed sudo later.  Which is fine.  But
then you need to configure it for you.

There are many ways to do things.  The easiest is to add yourself to
the "sudo" group.

  # adduser YOURUSERNAME sudo

You need to be root in order to configure root.  The "#" in the above
is used to signify the normal root prompt.  But of course if you can
be root with su then you don't need sudo since you can use su.
However sudo is quite convenient.

After adding your account to the root group you must log out and then
log back in again.  Groups are assigned to the user only at the time
that they log into the system.  If you assign yourself a new group
then in order for the new group to be added to your account process
you must log in again.  Then check it.  For example:

  $ id
  uid=1000(rwp) gid=1000(rwp)
  groups=1000(rwp),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),44(video),46(plugdev),50(staff),108(lpadmin),112(powerdev),120(fuse),145(kvm)

If you are in the sudo group then your password will allow sudo to
function for you.

  $ sudo id
  uid=0(root) gid=0(root) groups=0(root)

As long as you are adding yourself to groups you might as well do
yourself a favor and add yourself to the "adm" (/var/log file access)
and "staff" (/usr/local access) groups.  It will come in handy later.
So you might as well do all three at once.  Since you have to log out
and back in again anyway might as do all of the useful ones at the
same time.

  # adduser YOURUSERNAME sudo
  # adduser YOURUSERNAME adm
  # adduser YOURUSERNAME staff

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: