I want to give permission to a user to do shutdown command without password. Shutdown command need root privileges. If I give NOPASSWD
in /etc/sudoers
, the user can do all command that need root privileges without entering password. I want the user just has shutdown
command permission without password, not other commands.
My exact goal is to do shutdown automatically after finished downloading a huge file. So, the user can do this:
wget *download link* || shutdown -hP now
I read somewhere that sudo can only remember password for about 15 minutes. So, if I do
sudo wget *download link* || shutdown -hP now
or
wget *download link* || sudo shutdown -hP now
and downloading process take more than 15 minutes, it will asking for password when I'm not around.
So, How do I add a command permission to specific user to do it without password?