This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!
sudo
¶
sudo
allows a system administrator to delegate authority to give certain users - or groups of
users - the ability to run commands as root or another user while providing an audit trail of the
commands and their arguments.
Table of contents¶
Install¶
Config¶
-
Configure
sudo
, e.g. to give the userresu
the same privileges as root:# sudo EDITOR=vi visudo # edit the sudoer file > ... > # time sudo will remember a password (-1 for infinite): > Defaults:resu timestamp_timeout=15 > > # Root privilege specification > root ALL=(ALL:ALL) ALL > > # Members of the admin group may gain root privileges > %admin ALL=(ALL) ALL > > # Allow members of group sudo to execute any command > %sudo ALL=(ALL:ALL) ALL > > # give a user the same privileges as root: > resu ALL=(ALL) ALL > ...
-
Add a user to the
sudo
group -
Print the current
sudo
configuration: -
Give a user
sudo
rights, without password check, for a specific directory (e.g.~/bin/
): -
Give a user
sudo
rights, without password check, anywhere:
Use¶
Now sudo
can be prepend to any command in order for this command to be executed as root.
-
Create a file as root:
-
Enter the root shell as if you logged in with the root user:
If this cheat sheet has been useful to you, then please consider leaving a star here.