Sie sind auf Seite 1von 3

Fix Broken Sudo http://www.psychocats.

net/ubuntu/fixsudo

Fix Broken Sudo


How does sudo work?
Cause and symptoms
Booting into recovery mode
Do the actual repair

How does sudo work?


the psycho cat on an HP Mini with Ubuntu The way that Ubuntu has implemented sudo, the /etc/sudoers file says that users in the
admin group can (after a password authentication) temporarily escalate to system-wide
Just Beginning privileges for particular tasks. And then the /etc/groups file says which users are in the
Introduction admin group.
Read this first before you try
Ubuntu* You can read more on the community documentation about Ubuntu's implementation
of sudo.
Which Ubuntu to pick?
Getting Ubuntu Cause and symptoms
Making a bootable USB of Ubuntu sudo breaks when one or more of the following occurs:

Ubuntu inside Windows the /etc/sudoers file has been altered to no longer allow users in the admin group
Dual-boot with Windows to escalate privilege
Install Desktop CD Ubuntu the permissions on the /etc/sudoers file are changed to something other than
Modest Specs 0440
a user who should not have been has been taken out of the admin group
Install Software
Extra Repositories Problem Fixed (as of Ubuntu 10.04):

Security in Ubuntu
Create a "browse as root"
launcher*

Where's the Terminal?


Password in Terminal

Next Steps
Mount Windows
Install Proprietary Software
Install Flash
Install MP3 Playback
Finding iTunes Alternatives
Export as MP3 in Audacity
Use Wine

Beyond the Basics


As of Ubuntu 10.04, you are now warned before you can remove the last admin user
Backing up Ubuntu
from the admin group, at least if you do it through the graphical user interface.
Upgrade Ubuntu*
Change boot menu It took only two years to get this idea implemented:
Mount Linux Idea #11107: Users and Groups should always make sure at least one user is in the
admin group. Glad it happened, though!
Playing Around
KDE/Gnome Comparison Old problem:
Install KDE
Install XFCE
Pure Gnome
Pure KDE
Pure XFCE
Make your own Ubuntu remix

Troubleshooting
Can't sudo
Graphical sudo
Forgot password

* Off-site link

Cheap Plugs
The most common way to break sudo is through going to System > Administration >
If you've found these tutorials
Users and Groups, and removing the only admin from the admin group (in other words,
useful, please consider donating a
unchecking the Administer the system box for the only user who is able to administer
small amount to one of my
the system).

1 of 3 06/21/2010 08:58 AM
Fix Broken Sudo http://www.psychocats.net/ubuntu/fixsudo

favorite non-profits/charities. If you think it's silly that the last admin user can be so easily removed graphically from
Every little bit helps. the admin group, vote for Idea #11107: Users and Groups should always make sure at
least one user is in the admin group on Ubuntu Brainstorm.
You may also want to consider
donating directly to the Ubuntu
project.

If sudo is broken this way, you may notice an error saying you're not in the sudoers file
and the incident is going to be reported. Or you may just see the next command
prompt without any action being executed.

Booting into recovery mode


Since fixing sudo involves editing system files, and you would otherwise need sudo to
do so, you'll have to boot into recovery mode to gain root (system-wide) access in
order to repair sudo.

If you have a single-boot (Ubuntu is the only operating system on your computer), to
get the boot menu to show, you have to hold down the Shift key during bootup.

If you have a dual-boot (Ubuntu is installed next to Windows, another Linux operating
system, or Mac OS X; and you choose at boot time which operating system to boot
into), the boot menu should appear without the need to hold down the Shift key.

For older versions of Ubuntu (9.04 and 8.04), you can press the Escape key during
bootup in order to see the boot menu.

From the boot menu, select recovery mode, which is usually the second boot option.

After you select recovery mode and wait for all the boot-up processes to finish, you'll be
presented with a few options. In this case, you want the Drop to root shell prompt
option so press the Down arrow to get to that option, and then press Enter to select it.

The root account is the ultimate administrator and can do anything to the Ubuntu
installation (including erase it), so please be careful with what commands you enter in
the root terminal.

Do the actual repair

Case 1: If you'd removed your last admin user from the admin group, then type

adduser username admin

where username is your actual username.

Case 2: If you had previously edited the /etc/sudoers file and screwed it up, then type

2 of 3 06/21/2010 08:58 AM
Fix Broken Sudo http://www.psychocats.net/ubuntu/fixsudo

sudo cp /etc/sudoers /etc/sudoers.backup


sudo nano /etc/sudoers

(the proper command is actually sudo visudo, which checks syntax before you save the
/etc/sudoers file, but in some older versions of Ubuntu, that command uses the vi editor,
which can be confusing to new users, as opposed to nano, which is more
straightforward)

and make it sure it looks 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

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification


root ALL=(ALL) ALL

# Allow members of group sudo to execute any command after they have
# provided their password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d

# Members of the admin group may gain root privileges


%admin ALL=(ALL) ALL

When you're done making changes, press Control-X, Y, Enter.

Case 3: If you are trying to fix the error where it says sudo is mode _____, should be
0440, then you'll want to type

chmod 0440 /etc/sudoers

When you're done with whatever commands you needed to enter, type

exit

This will bring you back to the recovery menu.

Choose to resume a normal boot. Then you should be able to sudo again.

If you have suggestions or corrections for these tutorials, please post in this Ubuntu Forums thread
or leave a comment on my blog.

I will not give help to people posting in the above places. If you require technical support, start a
support thread on the Ubuntu Forums. That is the appropriate place to ask for help.

3 of 3 06/21/2010 08:58 AM

Das könnte Ihnen auch gefallen