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
Patryk
  • 9,146

2 Answers2

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.

Bruno Pereira
  • 73,643
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

mr2k
  • 479