Simple sudo settings to prevent unwanted Linux or UNIX privilege escalation: Per-command sudo authentication and path restriction

The default sudo configuration caches successful authentication using a timestamp, allowing commands to execute without a password prompt for a limited period. This can cause security risks, such as local privilege escalation if an attacker accesses an unlocked terminal session or if a malicious script automatically escalates its own privileges within the cached timeframe. Additionally, restricting the execution path ensures that sudo only executes verified, system-installed packages. Here is how to configure sudo to require per-command authentication and restrict the execution path for commands. Edit the sudoers file Start modifying the /etc/sudoers configuration file by using the following command as … Continue reading →