Results 1 to 6 of 6

Thread: Unable to add to sudoers list

  1. #1
    Join Date
    Apr 2006
    Beans
    59

    Unable to add to sudoers list

    I am using ubuntu 12.04 lts
    I created a user and added to sudoers list using
    sudo adduser username sudo.

    Then in the /etc/sudoers i made the following change
    %sudo ALL=(ALL:ALL) ALL
    to
    sudo ALL=(ALL:ALL) ALL

    Now after that neither me nor the new user are in sudoers list (
    I had to set root passwd and only root has the rootly power. neither me nor the newuser has
    Can anybody advise?

  2. #2
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: Unable to add to sudoers list

    Quote Originally Posted by chinna saaeb View Post
    Then in the /etc/sudoers i made the following change
    %sudo ALL=(ALL:ALL) ALL
    to
    sudo ALL=(ALL:ALL) ALL
    You shouldn't have done this.

    The % means group, that line meant that everyone in the sudo group has sudo privileges.

    By removing the % you changed the line to mean that the user sudo (instead of the group) has sudo privileges (this user doesn't exist), thereby removing everyone in the sudo group from your sudoers declarations and locking them out.

    Change that line back to what it was originally, either by booting in recovery mode or from a live CD.
    Cheesemill

  3. #3
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: Unable to add to sudoers list

    You also can try
    Code:
    pkexec visudo
    to edit /etc/sudoers without rebooting. It should work on newer Ubuntu releases as PolicyKit can grant you root privileges independent of sudo.
    Last edited by schragge; April 26th, 2013 at 09:29 AM.

  4. #4
    Join Date
    Apr 2006
    Beans
    59

    Re: Unable to add to sudoers list

    Thans It worked

  5. #5
    Join Date
    Apr 2008
    Beans
    18

    Re: Unable to add to sudoers list

    schragge, I have tried every suggestion for editing the /etc/sudoers.d/ or the /etc/sudoers.d/README file, including the new one (pkexec visudo) you posted above (I'm running Ringtail 13.02). In every case I get Permission Denied, whether I'm root or not. Both you and Chinna saabe seem to have no problem opening and editing the file. I can open /etc/sudoers.d as a tmp file, but it won't let me save the changes.

    I've been working on this off and on for two weeks without success. I have new software to install and I dread the endless authentication calls I know I'm going to face if I try to do it without changing the etc/sudoers.d/ file. Any suggestions will be deeply appreciated. I've run out of suggestions to try in the Ubuntu Forums.

  6. #6
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: Unable to add to sudoers list

    Hi

    /etc/sudoers.d/ is a directory, although /etc/sudoers.d/README is a file.

    Are you sure your not trying to edit the file /etc/sudoers instead ?

    You should be able to edit it from a root shell from the recovery menu from grub.

    You may have to remount the root partition read/write.

    Code:
    mount -o remount,rw /
    then edit the file.

    If not please post back

    Code:
    ls -l /etc/sudoers
    and

    Code:
    lsattr /etc/sudoers
    from the recovery console.

    EDIT:

    If for some really odd reason you can't change it from the recovery consoles root shell, edit your kernel command line and add

    Code:
    init=/bin/bash
    to boot into a bash shell. Mount the root partition read/write and edit it that way.

    BTW: Your root partition is being mounted read/write ? Check in dmesg or by using the mount command (i assume you're using ext4 ?)

    Kind regards
    Last edited by matt_symes; May 11th, 2013 at 04:28 AM. Reason: Extra info
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •