Find the answer to your Linux question:
Results 1 to 9 of 9
I changed the permissions of /etc/sudoers trying to make it writable using following command: sudo chmod o+w /etc/sudoers and now when i try to use the sudo command i am ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Posts
    6

    Permissions of /etc/sudoers got changed


    I changed the permissions of /etc/sudoers trying to make it writable using following command:
    sudo chmod o+w /etc/sudoers

    and now when i try to use the sudo command i am getting the following error:
    /etc/sudoers is mode 0442 should be mode 0440

    Can anyone help me out of this?

    Thanks in advance

  2. #2
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    Why did you do that? Only root should edit this file via visudo command. It'd be a huge security hole if anyone than root could edit this file.

  3. #3
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    877
    What keeps you from changing it back to 0440?

  4. #4
    Just Joined!
    Join Date
    Sep 2010
    Posts
    6
    Quote Originally Posted by Segfault View Post
    What keeps you from changing it back to 0440?

    Changing it back to 0440 requires sudo as in :
    sudo chmod o-w /etc/sudoers

    But sudo is giving error:
    sudo: /etc/sudoers is mode 0442 should be mode 0440


    thats why i cant change its mode back to 0440.

  5. #5
    Just Joined!
    Join Date
    Sep 2010
    Posts
    6
    yeah... but i was thinking of changing this file contents such that me (my user name) gets all priviledges of root.

    Anyway is there any solution now ?

  6. #6
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    You have to edit this file to give your user some permissions, not to change its file permissions.

    Do you know your root password?
    Then run
    Code:
    su
    chmod 440 /etc/sudoers
    exit
    If not you have to do this from outside your system (e.g. Linux Live CD).

  7. #7
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    877
    Log in using single user mode, or boot from a liveCD. I take su does not work with your distro?

  8. #8
    Linux Engineer Segfault's Avatar
    Join Date
    Jun 2008
    Location
    Acadiana
    Posts
    877
    Quote Originally Posted by padambengani View Post
    yeah... but i was thinking of changing this file contents such that me (my user name) gets all priviledges of root.
    Don't want that, this will tear down the whole security of your system. Learn how to give your user all rights you need, but nothing more.

  9. #9
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    And when you're done run
    Code:
    sudo passwd root
    and set a secure password for your root. That will enable the root account (and thus su) if it's disabled. But don't make use of your root account when you don't need to.

Posting Permissions

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