Removing multiple accounts with UID 0

Posted on 2012-09-13
Medium Priority
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

woolmilkporc earned 1000 total points
ID: 38394175
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

abbright earned 1000 total points
ID: 38394272
You might also just delete the relevant lines /etc/passwd and /etc/shadow. You don't need to do anything else.

Author Comment

ID: 38409635
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.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If, like me, you have a lot of Dell servers in the estate you manage this article should save you a little time. When attempting to login to iDrac on any server I would be presented with two errors. The first reads "Do you want to run this applicati…
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month16 days, 11 hours left to enroll

862 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