Multiple ROOT accounts on system

-1

I have about three ROOT accounts on my system, I have no idea how this happened but I have been messing with useradd and userdel, so maybe the two accounts I removed were replaced with a root account.

My question is, how would I delete the other root accounts?

When I type userder -r root, it says no user exists

Any help would be greatly appreciated!

illusionist

Posted 2016-12-12T14:49:38.330

Reputation: 1

1There is no such command as userder – Ramhound – 2016-12-12T14:53:10.937

You could try this. Untested. cat /etc/passwd | grep root

That should output one line: root:x:0:0:root:/root:/bin/bash

Do you have more than that one line? – Trevor – 2016-12-12T14:56:13.933

1When you say multiple root accounts, do you mean there are multiple accounts in /etc/passwd named root, or do you mean there are multiple accounts with a UID of 0? – virtex – 2016-12-12T14:59:17.413

Answers

0

Each account on a system has a number assigned to it. You may see these user id numbers with the id command, without becoming a privileged user or those user accounts.

vagrant@host:~$ id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),118(sambashare)
vagrant@host:~$ id ntp
uid=105(ntp) gid=110(ntp) groups=110(ntp)
vagrant@host:~$ id pulse
uid=109(pulse) gid=119(pulse) groups=119(pulse),29(audio)
vagrant@host:~$ id root
uid=0(root) gid=0(root) groups=0(root)
vagrant@host:~$ for ACCOUNT in root ntp pulse ; do id $ACCOUNT; done 
uid=0(root) gid=0(root) groups=0(root)
uid=105(ntp) gid=110(ntp) groups=110(ntp)
uid=109(pulse) gid=119(pulse) groups=119(pulse),29(audio)
vagrant@host:~$ 

As @Trevor mentioned in the comments, you can (without being the root account) grep through the /etc/password file for a list of accounts that have the word root in the name. I would do grep -i root /etc/passwd for a case-insensitive search. The id command can help identify the user IDs attached to each name.

I suspect that there may be account names like 'root ' and ' root ' created (note the spaces between the apostrophes) but these will not have UID zero. The id command should help identify the user ID values and user names; the parentheses around the name should help provide a clear argument to userdel so you are able to remove unneeded accounts.

StandardEyre

Posted 2016-12-12T14:49:38.330

Reputation: 348