0

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?

muru
  • 197,895
  • 55
  • 485
  • 740
  • 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 Answers1

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.