Closed kmn closed 3 months ago
visudo -f
edits a file in isolation so there is no way for visudo
to know whether it is an include file for another sudoers file. If you are editing a file in /etc/sudoers.d
you should verify that the entire sudoers file parses correctly by running visudo -c
. Perhaps visudo
needs an option explicitly for editing files in an includedir.
Newer versions of sudo will recover from errors like this instead of refusing to run.
Issue
visudo -f
does not raise errors even if the same alias names ofCmnd_Alias
are defined in/etc/sudoers
or/etc/sudoers.d/*
. After duplicating alias name definition ofCmnd_Alias
,sudo
fails like this error message.Reproducibility
sudo visudo
and add last two lines at the end of the/etc/sudoers
.sudo visudo -f /etc/sudoers.d/cameong2
and add following two lines to/etc/sudoers.d/cameong2
.sudo
command, then the following error occurs and fails.Execution order is important.
When executing
sudo visudo
aftersudo visudo -f
,sudo visudo
raises errors and successfully fails.