Removing multiple accounts with UID 0

Posted on 2012-09-13
Last Modified: 2012-09-18
We are running a RHEL 6 server, and for reasons I won't delve into at the moment a few additional accounts were created with UID 0 giving them root access.

I want to get rid of them, but trying to delete the user by username doesn't work as the OS goes by UID and says they are logged in. If I try to log them out all processes owned by root are killed off (ya, learned that the hard way).

I theorize that using usermod might let me change the UID - but I don't know if that will also affect the root account.

Should I just create a dummy account, then edit /etc/passwd to set the UID and group for each account to the UID / group of the dummy account, then remove them all?

What do you suggest that will not result in locking up the server?

Question by:RKFcomputers
    LVL 68

    Assisted Solution

    Just edit /etc/password and change the "wrong" UIDs to numbers of your choice.

    You can delete these accounts then by means of "userdel", if you wish.
    LVL 10

    Accepted Solution

    You might also just delete the relevant lines /etc/passwd and /etc/shadow. You don't need to do anything else.

    Author Comment

    Thank you both!

    Sadly I'm not getting alerts from Experts Exchange, so I didn't see these until now.

    I've copied the passwd to a backup, just in case, then deleted all the users but one. That one I'll probably change to a new user number.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    ​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
    Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now