I am supposed to clear all users that have the ID of 0 other than root. For example, my passwd file contains a user root with ID 0 and a user homer with ID 0.
I tried something like
grep :x:0: passwd | grep -v root:x: | awk -F : '{ print $1 }' | xargs userdel
but I received error userdel: user homer is currently logged in even though I am logged in as root, not homer. This error comes from them sharing and ID, I presume.
Is there any way around this? Should I just edit the passwd and shadow files? Otherwise, is there a way to force id 0 to be unique so that we can guarantee no other users will be created with id 0? Thanks.