Interview Prep/Linux/SSH, sudo and authentication

After editing `/etc/sudoers` with a text editor, every `sudo` command fails with `sudo: parse error in /etc/sudoers near line 31` and nobody can become root.

IntermediateTroubleshootingSSH, sudo and authentication
Answer

Likely causes → Syntax error in sudoers; sudo refuses to run with a broken policy.

Diagnose →

pkexec visudo -c 2>/dev/null       # if polkit is available

Fix → Use pkexec visudo if polkit works; otherwise log in as root on the console, or reboot into rescue mode (rd.break / init=/bin/bash), remount rw and fix the line with visudo -c -f /sysroot/etc/sudoers.

Prevent → Only edit with visudo (it validates), and use drop-ins in /etc/sudoers.d/ deployed with validation.

All Linux questions Roadmap: Linux

More on SSH, sudo and authentication