0

I have run a script https://github.com/starlilyth/Linux-PoolManager to install it and I have run into the situation where on each sudo command I get the prompt:

[sudo] password for root: 

the /etc/sudoers looks like this now :

-r--r----- 1 root root 823 mar  7 16:07 /etc/sudoers

And I cannot access it.

What can I do now to restore the system to normal functionality ?

EDIT

$grep sudo /etc/group
 sudo:x:27:USERNAME
3
  • /etc/sudoers is a file, not a directory. You can check it with sudo cat /etc/sudoers and modify it with sudo visudo
    – MrVaykadji
    Mar 7, 2014 at 15:26
  • There is nothing wrong with the permissions of your /etc/sudoers file.
    – jobin
    Mar 7, 2014 at 15:39
  • @Jobin it says read, and if read is all he can how can he use sudo visudo to fix things? Mar 7, 2014 at 15:48

2 Answers 2

3

Use the instructions on this answer to access a recovery shell.

Once you have your file system mounted with write support just move the file /etc/sudoers to another place and restore the original configuration with apt-get install sudo.

Also, if you do not remember the password for your user you can take the chance and use the command passwd yourusername to change it on the recovery shell.

1

The sudoers file is default like this:

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults    env_reset

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

This does not contain your user so to be able to use sudo add this:

<username> ALL=(ALL) ALL

That will grant you sudo-access. (If its the best way to do it I'm not sure, but it works for me when I install Debian)

Also, take a look at this community documentation for more information:

https://help.ubuntu.com/community/Sudoers

2
  • Check my edit - I do not have access to /etc/sudoers.....
    – Patryk
    Mar 7, 2014 at 15:33
  • Then I am at loss. Have you tried through the recovery console?
    – mr2k
    Mar 7, 2014 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .