As a system administrator I want to give permission for user let's say "teacher" to run commands as root without knowing password of root, what to do?
Asked
Active
Viewed 1,818 times
0
-
Or https://askubuntu.com/questions/90726/is-it-possible-to-give-sudo-access-to-only-a-particular-command, probably – muru Dec 19 '17 at 10:08
1 Answers
0
You can add a Cmnd alias into sudoers file, edit it with visudo to prevent accidentally getting yourself locked out of the file. Then make a global alias for the command in the global bashrc.
Add to visudo:
Cmnd_Alias ADDUSER_PASS = /usr/sbin/adduser
user_name ALL=(ALL) ADDUSER_PASS
Add to /etc/bash.bashrc:
alias adduser="sudo /usr/sbin/adduser"
Replace the user_name with the user you want to have access and the command directory for whatever command you want them to use.

Tom Bailey
- 156