Removing the dangerous rule

Take the rule away

Each file in /etc/sudoers.d/ is a drop-in rule. Removing the dangerous one is a single command:

sudo rm /etc/sudoers.d/student-maint
sudo -l

In the terminal (the less rule is gone from your sudo rights)

student@vulntech:~$ sudo rm /etc/sudoers.d/student-maint
[sudo] password for student:
student@vulntech:~$ sudo -l
Matching Defaults entries for student on vulntech:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin,
    use_pty, lecture=never

User student may run the following commands on vulntech:
    (ALL : ALL) ALL
    (ALL : ALL) ALL

If the user genuinely needed to run one real command as root, you would replace this with a rule naming that exact command — never a shell, pager or editor. Least privilege, always.

HOME LABS COMMUNITY DASHBOARD
Practice terminal Starting…