Bugzilla – Bug 367
validating sudoers content
Last modified: 2010-06-18 16:51:43 MDT
One of the users of my Debian packaging of sudo pointed out a while back that a change in sudoers syntax or semantics at one point caused him to lose root access to a system he was in the process of upgrading, and he thus requested that I add a check to my packaging to validate the content of sudoers and abort the upgrade if it appears incompatible with the new sudo version being installed. I suspect there's a way to do this reliably with the existing sudo options and exit codes, but it's not immediately obvious what the best approach would be? What we want, I think, is just a "go/no-go" indication of whether sudo is going to run or error out when it reads and parses sudoers. Thoughts? Bdale
You should be able to use "visudo -cf /etc/sudoers" to verify that the sudoers file parses correct. If you get back "/etc/sudoers: parsed OK" sudo should be able to parse the file.
Running "visudo -q -c" and checking the exit status should be sufficient.