I have set the UID of user01 to be 0 when I created it. Now I am trying to delete the user and it complains "user01 is currently logged in". I check the process list, and that doesn't seem to be true. However, root (which also has UID of 0) has processes running. How can I delete user01? I also tried changing UID of user01 with usermod, with no luck.

  • How are you trying to delete the user exactly? What operating system is this? – David Schwartz Aug 24 '15 at 20:10
  • This is Linux: 3.14.42-31.38.amzn1.x86_64 . Used command "userdel user01" – James Velez Aug 24 '15 at 20:59

I would do that with:

sed -i '/user01/d' {passwd,shadow}
  • 1
    Followed by rm -r /home/user01 to get rid of their home directory ! (James, Adams command deletes the entry from the password and shadow files, effectively killing that user) – davidgo Aug 24 '15 at 21:52
  • This worked! I needed to run this at /etc directory. – James Velez Aug 24 '15 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.