Safely modify sudoers

Ensures syntactic validity of sudoers file before writing it out.

Still possible to lock yourself out of your system, but harder at least :)

References #258