Where Is the sudoers File?
sudo reads /etc/sudoers plus drop-ins in /etc/sudoers.d. Edit only with visudo, never by hand.
Last updated
sudo layers config: main sudoers file first, then every file in sudoers.d. Distros expect custom rules as drop-ins, leaving the shipped file untouched.
Syntax errors lock out all admins, which is why visudo exists. It validates before writing. Permissions matter too: files must be 0440 or sudo ignores them.
Where sudo stores this, by platform
/etc/sudoers + /etc/sudoers.d/
Main rules plus drop-in folder. Custom grants go in sudoers.d files at 0440. Validate with visudo -c.
Frequently asked questions
How do I grant passwordless sudo for one command?
Add a file in /etc/sudoers.d with the rule and mode 0440. Test with sudo -l for that user. Drop-ins beat editing the main file.
Broke sudoers. How do I recover?
Boot to recovery or a live USB, mount the root, and fix perms to 0440. sudo refuses to run with a broken sudoers, so recovery media is the way back.
Why must I use visudo?
Always visudo. It syntax-checks before saving and refuses broken files. Direct edits risk locking every admin out at once.
Notice an outdated path? Let us know.