7

I installed some software by running its install script with

sudo ./install.sh

After the installation all the accounts on my Ubuntu laptop can gain root access by simply issuing the command sudo -s, even the standard (non administrator) account. Also there is no password prompt when issuing the command sudo -s.

My /etc/sudoers looks like this:

Defaults    env_reset
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

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

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
ALL ALL=(ALL) NOPASSWD:ALL
  • 1
    Open the install script in text editor. See what it was doing with /etc/sudoers and revert them. – Web-E Jul 4 '13 at 10:54
  • 1
    This may have been done by that "particular software" you mentioned. Unless they warned you that this will happen you should file this as a bug against the software. – Takkat Jul 4 '13 at 10:54
  • 2
    Can we also get a link to where you got the script please? – Rinzwind Jul 4 '13 at 14:04
  • 1
    It's a serious security bug for any software's installation script to add a line like ALL ALL=(ALL) to a sudoers file. So if possible, please do let us know where you got the installation script (as @Rinzwind says) and/or what software the script came with or is for, so that the bug can be reported to its developers and hopefully fixed quickly. Thanks! – Eliah Kagan Jul 9 '13 at 1:35
  • 1
    sooo, what was this software? – j0h Jul 9 '13 at 19:23
7

If you look at the very bottom of your sudoers file, it says "ALL ALL=(ALL) NOPASSWD:ALL". This is the syntax for passwordless execution of sudo. Make a backup of the file and then delete that line.

Andrew

| improve this answer | |
  • 1
    But why does non adminstrator accounts can also sudo to the root ? – coder Jul 4 '13 at 14:36
  • 3
    The line says "ALL", indicating all users. – ahalverson Jul 4 '13 at 18:43
4

Remove this line:

ALL ALL=(ALL) NOPASSWD:ALL

But this is REALLY strange to appear, so the software (basically a script I guess) you installed is probably mallicious. You might want to start a second question, paste the contents of that script there, and ask for advice... this is scary!

| improve this answer | |
  • But why does non adminstrator accounts can also sudo to the root ? – coder Jul 4 '13 at 14:39
  • 1
    Because that's exactly what that line says? ALL is the keyword here. The line starting with %admin says that all members of group admin have sudo rights, and this line says that everyone has it. – Nanne Jul 4 '13 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.