• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

UNIX / Linux : How to delete root equivalent user (Non-Root User with UID 0)

by admin

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.

Filed Under: Linux

Some more articles you might also be interested in …

  1. ac: command not found
  2. fstrim Command Examples in Linux
  3. View files using – cat, more, tail, head and wc commands
  4. cpulimit: command not found
  5. gprbuild Command Examples
  6. gosource Command Examples
  7. debugfs: command not found
  8. dar Command Examples in Linux
  9. sestatus: command not found
  10. “git restore” Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright