Root

From FreekiWiki
Revision as of 12:25, 29 September 2011 by Rhean (talk | contribs) (Added Resetting Root Passwords Section)
Jump to navigation Jump to search

The root user, or more simply 'root', is the administrative account on a linux or unix box. This account has its own home directory (/root) and has access to all parts of the system. Root also has a reserved space on the hard drive, so that it can still function when the hard drive is maxed out.

Becoming root

In order to access the root account, on most linux and unix boxes you can log in directly, use su to switch to that account, or use sudo to access root privileges on a line by line basis.

Logging Into Root Directly

If you are at a console login screen on most linux and unix boxen, you can type root, hit enter, and then type in the password. The root prompt will generally start with the machine name and end with a "#" sign

su

On most linux systems, you are not allowed to log in to root directly in the graphical login screen. There are exceptions, but it is still usually a bad idea. In that case, or in most cases where you have a console (text) screen, you can switch to root by typing "su", or "su -", then enter and then the root password.

sudo

A linux box can be configured to allow root privileges to selected users on a command-by-command basis. In order to use this, the user prepends "sudo" to the command line. The system will ask then for the user's password before performing the action.

$ sudo dhclient eth0
Password:
<action done>
$

instead of

$ su
Password:
# dhclient eth0
<action done>
#

On Ubuntu systems, the root account is disabled and all root access is through sudo. However, one can still get a root prompt by using "sudo su" or "sudo -i" followed by the user's password.

Resetting Root Passwords

Please see Lost_Password