Interview Prep/Linux/SSH & Access Hardening

How do you harden sudo in production?

IntermediateProductionSSH & Access Hardening
Answer
  • Use groups and files in /etc/sudoers.d/, managed by config management and validated with visudo -cf.
  • Avoid blanket NOPASSWD: ALL for humans; scope service accounts to exact commands.
  • Defaults use_pty and Defaults logfile=/var/log/sudo.log, or I/O logging (log_output) for sensitive hosts.
  • Defaults timestamp_timeout=5.
  • Ship sudo logs centrally.
  • Never allow commands that spawn shells (vi, less, find, awk, python); use sudoedit for file edits.
All Linux questions Roadmap: Linux

More on SSH & Access Hardening