Results 1 to 6 of 6

Thread: /etc/ ownership and sudo problems

  1. #1
    Join Date
    Nov 2012
    Beans
    3

    /etc/ ownership and sudo problems

    I have tried many things related to this thread

    http://ubuntuforums.org/showthread.php?t=1642568

    without luck. I unwittingly changed the ownership of the entire /etc/ directory using

    chown -R username /etc/

    Now, when I try sudo commands in the terminal, I get

    sudo: /etc/sudoers is owned by uid 1000, should be 0
    sudo: no valid sudoers sources found, quitting

    I rebooted into recovery mode and tried various combinations of the following commands:

    chown -R root /etc
    chown root:root /etc/sudoers

    If I go in the directory using the GUI, I can change permissions in the folder that way to get different combinations but none of those work either.

    I am new to posting in the forum, so I apologize if I screwed up any standard of posting. Any help is greatly appreciated.
    chmod 0440 /etc/sudoers

  2. #2
    Join Date
    Nov 2007
    Location
    NC, USA
    Beans
    829
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: /etc/ ownership and sudo problems

    Boot into the recovery (to gain root) and do:

    Code:
    chown -hR root:root /etc
    EDIT: Checking my /etc dir shows that some files are slightly different. The shadow and gshadow files should be root:shadow. cups dir should be root:lp. at.deny file should be root:daemon.
    Last edited by PinkFloyd102489; November 30th, 2012 at 11:34 PM.
    Linux User #460341 || Ubuntu User #19510 || Unanswered Posts Team

  3. #3
    Join Date
    Nov 2012
    Beans
    3

    Re: /etc/ ownership and sudo problems

    Quote Originally Posted by PinkFloyd102489 View Post
    Boot into the recovery (to gain root) and do:

    Code:
    chown -hR root:root /etc
    EDIT: Checking my /etc dir shows that some files are slightly different. The shadow and gshadow files should be root:shadow. cups dir should be root:lp. at.deny file should be root:daemon.
    I booted into recovery mode with root access and ran the command as shown above. It ran through the same sequence, labeling every file as read-only access, but I am still getting the same error when I run

    sudo -i

    sudo: /etc/sudoers is owned by uid 1000, should be 0
    sudo: no valid sudoers sources found, quitting

  4. #4
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: /etc/ ownership and sudo problems

    Usually you cannot write to the disk in recovery mode as it is mounted read-only. To fix this, boot into recovery, then run:

    Code:
    mount -o remount,rw -n /
    (Note there are no spaces around the comma.) Now try changing the permissions. Don't change the groups in /etc; just change the owner to repair the change you made originally.

    Code:
    chown -R root /etc
    When you're done, reboot.
    Last edited by SeijiSensei; December 1st, 2012 at 02:19 AM.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Nov 2012
    Beans
    3

    Re: /etc/ ownership and sudo problems

    Quote Originally Posted by SeijiSensei View Post
    Usually you cannot write to the disk in recovery mode as it is mounted read-only. To fix this, boot into recovery, then run:

    Code:
    mount -o remount,rw -n /
    (Note there are no spaces around the comma.) Now try changing the permissions. Don't change the groups in /etc; just change the owner to repair the change you made originally.

    Code:
    chown -R root /etc
    When you're done, reboot.
    SeijiSensei thank you for the help. It worked!

  6. #6
    Join Date
    Jan 2013
    Beans
    1

    Re: /etc/ ownership and sudo problems

    Alright, i'm a newbie to all this and things were going well until i blew up sudo but thats fixed thanks to SeijiSensei!

    first post as a thank you, thought that'd be the best entrance right?

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
  •