This pos describes how to delete a non-root user with UID zero. If you try to delete a user with UID 0 by userdel command, you will get the following error.
# id user2 uid=0(root) gid=0(root) groups=0(root)
# userdel user2 userdel: user user2 is currently used by process 1
If you need to delete non-root user having UID 0 (say user1), follow these steps:
1. Backup the /etc/passwd file before proceeding:
# cp /etc/passwd /etc/passwd.bkup
2. Open /etc/passwd and change the UID of user1 from 0 to a UID which is not used by any other user:
Give a higher number for the new UID and make sure you do not specify standard UIDs.
3. Now, delete the user:
Note – Never try to delete root user or change its UID.