If you try to delete a user with UID 0 by userdel command, you will get following error.
# id uid=0(root) gid=0(root) groups=0(root) # userdel userdel: user user01 is currently used by process 1
All the processes are owned by user IDs and not user-names. So, All process owned by root will be owned by root equivalent user, as they have same UID. To work around this issue follow the steps given below.
Deleting non-root user with UID 0
If you need to delete non-root user having UID 0 (say user01), follow the steps below.
1. Backup the /etc/passwd file.
# cp /etc/passwd /etc/passwd_bkp
2. Open /etc/passwd and change the UID of user01 from 0 to to a UID which is not used by any other user, for example:
change below entry from
user01:x:0:0::/home/user01:/bin/bash
to an entry shown below:
user01:x:2000:0::/home/user01:/bin/bash
3. Now, delete the user with userdel command. This time you should not get any error.
# userdel user01
Note – Never ever try to delete root user or change its UID.