sudo:allow_user_to_run_root_privileged_commands
Differences
This shows you the differences between two versions of the page.
sudo:allow_user_to_run_root_privileged_commands [2017/04/03 15:31] – created peter | sudo:allow_user_to_run_root_privileged_commands [2019/12/04 21:40] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Sudo - Allow user to run root privileged commands ====== | ||
- | |||
- | To allow a normal user to run root privileged commands, you have to use sudo. Sudo allows a user to run commands as superuser or another user. To set your user to be able to use sudo to act as superuser, a number of steps have to be done. | ||
- | |||
- | Login as superuser(root). | ||
- | Edit sudoers file using visudo. | ||
- | |||
- | <code bash> | ||
- | # visudo | ||
- | </ | ||
- | |||
- | Uncomment the below line and save. visudo uses vi as the text editor, so to save just press ' | ||
- | |||
- | < | ||
- | %wheel ALL=(ALL) ALL | ||
- | </ | ||
- | |||
- | Add your user to the group wheel (You can use any name for the group as long as you add it to the sudoers file). | ||
- | |||
- | <code bash> | ||
- | usermod -G wheel foo | ||
- | </ | ||
- | |||
- | To make all the superuser' | ||
- | |||
- | <code bash> | ||
- | vi / | ||
- | </ | ||
- | |||
- | Add the following lines, append if the line already exist. | ||
- | |||
- | <file bash / | ||
- | PATH=$PATH:/ | ||
- | export PATH | ||
- | </ | ||
- | |||
- | Save the file | ||
- | |||
- | To activate the changes, run: | ||
- | |||
- | <code bash> | ||
- | . .bash_profile | ||
- | </ | ||
- | |||
- | Now, you can use superuser environment variables, but without tab completion feature. | ||
- | |||
- | <code bash> | ||
- | vi / | ||
- | </ | ||
- | |||
- | Add the following line | ||
- | |||
- | <file bash / | ||
- | complete -cf sudo | ||
- | </ | ||
- | |||
- | Save the file. | ||
- | |||
- | To activate the changes, run: | ||
- | |||
- | <code bash> | ||
- | . .bashrc | ||
- | </ | ||
- | |||
- | Logout and login back. Now you can use sudo to execute root privileged commands, you inherited the root environment variables and you can use tab completion while using sudo. | ||
sudo/allow_user_to_run_root_privileged_commands.1491233507.txt.gz · Last modified: 2020/07/15 09:30 (external edit)