14.6. Becoming Superuser
Prev | Chapter 14. Users and Basic Account Management | Next

## 14.6. Becoming Superuser

There are several ways to do things as the superuser. The worst way is to log in as `root` directly. Usually very little activity requires `root` so logging off and logging in as `root`, performing tasks, then logging off and on again as a normal user is a waste of time.

A better way is to use su(1) without providing a login but using `-` to inherit the root environment. Not providing a login will imply super user. For this to work the login that must be in the `wheel` group. An example of a typical software installation would involve the administrator unpacking the software as a normal user and then elevating their privileges for the build and installation of the software.

Example 14.11. Install a Program As The Superuser
`%` `configure` `%` `make` `%` `su -` Password: `#` `make install` `#` `exit` `%`

Note in this example the transition to `root` is less painful than logging off and back on twice.

Using su(1) works well for single systems or small networks with just one system administrator. For more complex environments (or even for these simple environments) `sudo` should be used. It is provided as a port, `security/sudo`. It allows for things like activity logging, granting users the ability to only run certain commands as the superuser, and several other options.

Prev | Up | Next
14.5. Groups | Home | Chapter 15. Security

This, and other documents, can be downloaded from http://ftp.FreeBSD.org/pub/FreeBSD/doc/

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.