sábado, 25 de octubre de 2014

executing commands using sudo without ask for password

Sometimes is annoying write the root password for execute certain commands, specially if you are working on console mode, that's why is really great to custom sudo ( using visudo) in order to avoid the password prompt:

1. open your terminal
2. type sudo visudo
3. then add these lines:

User_Alias MANAGERS = user1, user2

Cmnd_Alias SHUTDOWN = /sbin/reboot, /sbin/halt

4. Then add this line at the end of the file:
MANAGERS ALL = (ALL) NOPASSWD: SHUTDOWN

that's it, save it and try it

At least for me it works putting the NOPASSWD line at the end, I'm not sure if the way SUDO reads this file is from bottom to top, anyway, try it

Best

No hay comentarios:

Publicar un comentario