no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | sudo [2016/02/02 00:15] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== sudo ====== | ||
| + | Use '' | ||
| + | |||
| + | < | ||
| + | EDITOR=vim visudo | ||
| + | </ | ||
| + | |||
| + | On Ubuntu, set the default editor: | ||
| + | |||
| + | < | ||
| + | sudo update-alternatives --config editor | ||
| + | </ | ||
| + | |||
| + | Display sudo commands the user can run: | ||
| + | |||
| + | < | ||
| + | sudo -l | ||
| + | </ | ||
| + | |||
| + | Run a command as a specific user: | ||
| + | |||
| + | < | ||
| + | sudo -u beandog -- whoami | ||
| + | </ | ||
| + | |||
| + | Switch to another user: | ||
| + | |||
| + | < | ||
| + | sudo -u beandog -s | ||
| + | </ | ||
| + | |||
| + | === Syntax ==== | ||
| + | |||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | === Examples === | ||
| + | |||
| + | Let user alan run rdiff-backup as another user, not requiring a password: | ||
| + | |||
| + | < | ||
| + | alan ALL= (clientuser) NOPASSWD: / | ||
| + | </ | ||
| + | |||
| + | Let user alan run one command as root: | ||
| + | |||
| + | < | ||
| + | alan ALL= NOPASSWD: / | ||
| + | </ | ||
| + | |||
| + | Allow user '' | ||
| + | |||
| + | < | ||
| + | steve ALL=(beandog) NOPASSWD: ALL | ||
| + | </ | ||
| + | |||
| + | Set PATH for new user. sudo will not pass the user's PATH when switching to another user by default, which can cause problems if calling binaries in /usr/local. Override it with the secure_path option. | ||
| + | |||
| + | < | ||
| + | Defaults secure_path = / | ||
| + | </ | ||