Validate the default sudoers file and included files without changing the configuration.
Which command is appropriate?
visudo -c parses sudoers in check-only mode and reports syntax, ownership, and mode problems.
Detailed explanation
sudo -cIncorrect. sudo -c is not the sudoers syntax-check option.
cat /etc/sudoersIncorrect. cat only prints contents.
sudo -lIncorrect. sudo -l lists policy for a user.
visudo -cCorrect. visudo -c validates sudoers syntax.
Try it yourself
An example you can run in a temporary verification environment.
visudo -h 2>&1 | grep -E -- '-c|--check' | head -n 1Expected result
-cまたは--checkの説明行Key points
- visudo is the dedicated parser
- -c means check
- Avoid direct edits
Notes
- Environment: sudo visudo help / sudoers読取・変更なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Permission bit
A mode bit controlling read, write, execute, or special execution behavior.
Account state
Attributes that determine whether a password or login account can be used.
Resource limit
A per-process or per-user ceiling such as open files or process count.