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?

marked as duplicate by muru, ravery, karel, Arronical, dessert Dec 19 '17 at 12:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


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

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.