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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. feedreader: command not found
  2. qm snapshot Command Examples in Linux
  3. faketime Command Examples in Linux
  4. LVM Configuration : Volume Group (VG) Operations/Utilities
  5. pacman-key: command not found
  6. alias Command Examples in Linux
  7. How to disable auto completion (tab completion) in bash shell
  8. ac: command not found
  9. jarsigner: command not found
  10. lvremove Command Fails With Error “LVM – Can’t remove open logical volume”

You May Also Like

Primary Sidebar

Recent Posts

  • qsub Command Examples in Linux
  • qsub: command not found
  • qrcp Command Examples in Linux
  • qmrestore Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright