Users and Superusers

Linux is a multiuser operating system: multiple people can use a single Linux computer at the same time. On a given computer, each user is identified by a unique username, like “smith” or “funkyguy,” and owns a (reasonably) private part of the system for doing work. There is also a special user named root—the superuser—who has the privileges to do anything at all on the system. Ordinary users are restricted: though they can run most programs, in general they can modify only the files they own. The superuser, on the other hand, can create, modify, or delete any file and run any program.

To become the superuser, you needn’t log out and log back in; just run the su command (see Becoming the Superuser) and provide the superuser password:

$ su -l
Password: *******
#

The superuser prompt (#) indicates that you’re ready to run superuser commands. Alternatively, run the sudo command (if your system is configured to use it), which executes a single command as the superuser, then returns control to the original user:

$ sudo ls /private/secrets           View a protected directory
Password: *******
secretfile1    secretfile2           It worked!
$

Get Linux Pocket Guide, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.