Monday 5, May 2025
We are moved to new domain
Click -> www.ehowtonow.com
Sunday, 16 July 2017

Execute command as the superuser - sudo Linux Command

sudo

sudo [options] [command]

Description

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 will inform an administrator via email. By default, it will send 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 overriden by settings in the /etc/sudoers file. Also see /etc/sudoers for configuration examples.

Options

-b
Execute command in the background.

-h
Print help message, then exit.

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

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

-p promptstring
Use the specified promptstring to prompt for a password. The string may contain the following escape codes, which will be replaced with the current user's login name and local hostname.

%h
Local hostname without the domain name.

%H
Local hostname with the domain name.

%u
Current user's login name

%U
Login name of the user the command will run under. The default is root.

%%
A single percent (%) character.

-s
Run the shell specified in the SHELL environment variable, or the default shell specified in /etc/passwd. If a command is given, it should be a shell script and not a binary file.

-u user
Run command as the specified user instead of the root user. This may also be specified as a user ID number using #uid.

-v
Update timestamp for user. Prompt for password if necessary.

-H
Set the HOME environment variable to the home directory of the target user.

-K
Remove user's timestamp.

-L
List parameters that may be set as defaults for a user in the /etc/sudoers file.

-P
Preserve initial user's group membership.

-S
Read password from standard input instead of from the console.

-V
Print version number, then exit. When run by the root user, print sudo's defaults and the local network address as well.

--
Stop reading command-line arguments.

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer

Related Posts:

  • Diff Linux Command diff diff [options] [diroptions] file1 file2 Compare two text files. diff reports lines that differ between file1 and file2. Output consists of lines of context from each file, with file1 text flagged by a < symbol and… Read More
  • ssh-keygen Linux Command ssh-keygen ssh-keygen [options] Generate, manage, and convert authentication keys for ssh. When using ssh-keygen to create a key, the -t option must be specified to identify the type of key to create. Options -b bits … Read More
  • SSH Linux Command ssh ssh [options] hostname [command] Securely log a user into a remote system and run commands on that system. The version of ssh described here is the OpenSSH client. ssh can use either Version 1 (SSH1) or Version 2 (SSH… Read More
  • ssh-add - Linux Command ssh-add ssh-add [options] [files] ssh-add -e|-s reader Add RSA or DSA identities to the authentication agent (see ssh-agent), which must be running and must be an ancestor of the current process. ssh-add reads the files c… Read More
  • man Linux Command man man [options] [section] [title] Display information from the online reference manuals. man locates and prints the named title from the designated reference section. Traditionally, manpages are divided into nine sect… Read More
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: Execute command as the superuser - sudo Linux Command Rating: 5 Reviewed By: eHowToNow