title: Deleting a User from Sudoers File Using a Script
body: <p>I am writing a code script that will delete a user from the Linux CentOS7 box and also remove their sudo permissions.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>echo -n "Please enter the username you'd like to delete: "
  read -r username
  passwd --lock $username
  userdel -r "$username"
  sudo userdel -r "$username" &gt;&gt; /etc/sudoers.d/sugroup
  </code></pre>
  
  <p>I know I may need to move the last line above the last userdel -r line, I definitely know I need some help in making sure that the code is working properly. I have a test box I am running this on so if it blows up, I can recreate it.</p>