O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

sudo

Synopsis

sudo [options] [command]
sudoedit [options] files

If you are allowed, execute command as the superuser. Authorized users of sudo and the commands they are permitted to execute are listed in the sudo configuration file, /etc/sudoers. If an unauthorized user attempts to run a command, sudo informs an administrator via email. By default, it sends the message to the root account. Users attempting to run commands are prompted for their password. Once authenticated, sudo sets a timestamp for the user. For five minutes from the timestamp, the user may execute further commands without being prompted for her password. This grace period may be overridden by settings in the /etc/sudoers file. Also see /etc/sudoers for configuration examples. The sudoedit form of sudo is equivalent to running sudo -e.

Options

-b

Execute command in the background.

-e

Edit one or more files instead of running a command, running the editor specified by the VISUAL or EDITOR environment variable. If a specified file does not exist, it is created.

-h

Print help message, then exit.

-H

Set the HOME environment variable to the home directory of the target user (default is root).

-i

Run the shell specified in /etc/passwd for the user sudo is being run as.

-k

Revoke user’s sudo permissions. Similar to -K, but changes user’s timestamp to the Epoch instead of revoking it.

-K

Remove user’s timestamp.

-I

List all allowed and forbidden commands for the user on the current host, then exit.

-L

List parameters that may be set as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required