Subject: sudo vs su commands under Linux / UNIX / BSD / AIX / HP-UX
Author: Unix
Posted on: 10/06/2011 03:10:59 PM
The Unix commands sudo and su allow access to other commands as a different user.
The sudo command
The sudo command stands for "superuser do". It is often used when certain rights are not granted to the current user. For example,
$ mkdir /usr/local/java
mkdir: cannot create directory `/usr/local/java': Permission denied
The command prompts you for your personal password and confirms your request to execute a command by checking a file, called
sudoers, which the system administrator configures. Using the
sudoers file, system administrators can give certain users or groups access to some or all commands without those users having to know the root password. It also logs all commands and arguments so there is a record of who used it for what, and when.
To use the sudo command, at the command prompt, enter:
sudo command
Replace command with the command for which you want to use sudo. For example
$ sudo mkdir /usr/local/java
Replies:
References: