The sudo command is a program for some Unix and Unix-Like operating systems, that allows a user to execute programs with the security privileges of another user. Typically those of a superuser or the root user.

Sudo Command

The sudo command is a program for some Unix and Unix-like operating systems that allow a user to execute programs with the security privileges of another user. Typically those of a superuser or the root user.

Through a configuration file, usually known as a sudoers file, an administrator of the system can delegate authority to certain users and give them the ability to run the specified commands as a root or as another user. The sudoers configuration file can also be configured to provide a log those commands usage and what their arguments were.

Example

Users typically execute a command to which they want to have elevated privileges by prefixing their command with the sudo command:

allan@company$ sudo vim /etc/group

If the user allan has been configured on the sudoers file to gain access to the /etc/group file, a password prompt will be shown and once allan introduces his password, vim will launch and allan can edit the /etc/group file with the same privileges of the root user.

If allan isn't a part of the sudoers configuration file, he will instead receive an error indicating he does not have access to /etc/group and cannot perform the command vim /etc/group.

On both cases the system will log the occurrences. A system administrator can later review these logs and audit all uses of the sudo command.

Links

Sudo Official Website.

Sudo Manual (Man) Page.

Sudoers Manual (Man) Page.