Skip to main content
The 2024 Developer Survey results are live! See the results

sudo - Execute a command with superuser privileges.

Sudo (superuser do) allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments.

The configuration file for sudo is /etc/sudoers (as well as /etc/sudoers.d/* in recent versions). Best practice is to use the visudo command to edit /etc/sudoers. This utility safeguards the user by locking the file (preventing simultaneous edits) and checking for syntax errors before saving the file. It can also be used to edit files in the /etc/sudoers.d directory, by using its -f, --file= option e.g.,

sudo visudo -f /etc/sudoers.d/customisations

Further reading