/ mozey.co / blog

sudo without password

July 1, 2013

Sometimes when scripting we need to allow certain groups or users to run sudo without being prompted for a password.

We might also want to limit this privilege to certain files.

sudo visudo

/etc/sudoers must be edited using above command

We can allow all the members of a group to sudo without a password

%admin ALL=(ALL) ALL

Or a specific user

ubuntu ALL=(ALL) NOPASSWD:ALL

And we might limit this to certain files

ubuntu ALL=(ALL) NOPASSWD: /path/to/files/*.sh