RootSudo

Contents

  1. Notes
  2. Allowing other users to run sudo
  3. Benefits of using sudo
  4. Downsides of using sudo
  5. Misconceptions
  6. Going back to a traditional root account
  7. Drag & Drop Sudo

In Linux (and Unix in general), there is a superuser named root. The Windows analog of root is Administrator. The superuser can do anything and everything, and thus doing daily work as the superuser can be dangerous. You could type a command incorrectly and crash the system. Ideally, you run as a user that has only the privileges needed for the task at hand. In some cases, this is necessarily root, but most of the time it is a regular user.

By default, the root account is locked in Ubuntu. This means you cannot login as root or use su. Instead, the installer will setup sudo to allow the user that is created during install to run all administrative commands.

This means that in the terminal you can use sudo for commands that require root privileges. All programs in the menu will use a graphical sudo to prompt for a password. When sudo asks for a password, it needs YOUR USER Password; this means that a root password is not needed.

Notes

Example #1

sudo chown bob:bob /home/bob/*

Example #2

sudo /etc/init.d/networking restart
rm /home/user/.{ICE,X}authority
sudo -i
sudo -i -u username

Allowing other users to run sudo

To add a new user to sudo, open the Users and Groups tool from System --> Administration menu. Then click on the user and then on properties. Choose the User Privileges tab. In the tab, find Executing system administration tasks and check that.

/!\ In the terminal this would be: sudo adduser $user admin, where you replace $user with the name of the user.

Benefits of using sudo

The benefits of leaving root disabled by default include the following:

Downsides of using sudo

Although for desktops the benefits of using sudo are great, there are possible issues which need to be noted:

Misconceptions

Going back to a traditional root account

<!> This is not recommended!

Consider using the below command instead:

sudo -i

That will open up a root console temporarily. Enabling the root account in Ubuntu is neither supported nor necessary. Anything you need to do as administrator of an Ubuntu system can be done via sudo or gksudo.

If the root account is enabled and you wish to disable it, open a terminal and issue the following command:

sudo passwd -l root

Drag & Drop Sudo

This is a trick from the [WWW] forums.

Create a launcher with the following command:

gksudo "gnome-open %u"

When you drag and drop any file on this launcher (it's useful to put it on the desktop or on a panel), it will be opened as root with its own associated application. This is helpful especially when you're editing config files owned by root, since they will be opened as read only by default with gedit, etc.


CategorySecurity

last edited 2007-03-08 19:44:15 by Ardchoille2