sudo and /etc/sudoers.d directory

sudo logo

I needed to add a new user into sudoers file into several debian machines, i didn’t want open a terminal in each machine and add the line manually, the other option was append a new line into the file like echo “new line”>> /etc/sudoers .But I don’t like edit sudoers file without using visudo, I don’t feel safe.

Reading the debian documentation I found a magical directive for append external files #includedir /etc/sudoers.d, that’s mean if I add a new file  with 0440 permisions and the permissions are important will be appended into our sudo config.

Removing the hash character is a inherited custom ok don’t remove the hash character  is not a comment indicador withouth the hash character, includedir /etc/sudoers.d is a bad line and visudo show an error.

Leave a Reply

Your email address will not be published. Required fields are marked *