ID Mistakenly set to UID & GID of 0

An ID appears to haven been set to a UID and GID of 0 same as root.

Can I use usermod -u and usermod -g to change it to something else like usermod -u 21006 cmnadm and usermod -g 100 cmnadm?

Or possibly just deleting with userdel -r cmnadm?

An application running this dedicated server is taking error as it is attempting to use cmnadm, when I believe its suppose to be using root.

On 18/09/17 13:04, duwallace wrote:
[color=blue]

An ID appears to haven been set to a UID and GID of 0 same as root.

Can I use usermod -u and usermod -g to change it to something else like
usermod -u 21006 cmnadm and usermod -g 100 cmnadm?[/color]

Yes that should work - you should check that no other user has UID 21006
(use “grep :21006: /etc/passwd”) and group 100 (“grep :100:
/etc/group”). Note on my desktop running openSUSE Leap the users group
has GID 100.
[color=blue]

Or possibly just deleting with userdel -r cmnadm?[/color]

Another option though you’d obviously then need to recreate.

Either way you should also check file and directory ownerships and reset
as necessary.
[color=blue]

An application running this dedicated server is taking error as it is
attempting to use cmnadm, when I believe its suppose to be using root.[/color]

It’s certainly not a good idea to create another user and/or group using
UID/GID 0.

HTH.

Simon
SUSE Knowledge Partner


If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below. Thanks.

On 09/18/2017 07:06 AM, Simon Flood wrote:[color=blue]

On 18/09/17 13:04, duwallace wrote:
[color=green]

An ID appears to haven been set to a UID and GID of 0 same as root.

Can I use usermod -u and usermod -g to change it to something else like
usermod -u 21006 cmnadm and usermod -g 100 cmnadm?[/color]

Yes that should work - you should check that no other user has UID 21006
(use “grep :21006: /etc/passwd”) and group 100 (“grep :100: /etc/group”).
Note on my desktop running openSUSE Leap the users group has GID 100.[/color]

Just to be safe I would backup /etc/shadow /etc/passwd and /etc/group
first, mostly because if the commands do not behave as we hope/expect
(this is not a normal, expected situation) then you could lose ‘root’ and
that would be sad.

tar -jcvf /root/names.tbz /etc/shadow /etc/passwd /etc/group

[color=blue][color=green]

Or possibly just deleting with userdel -r cmnadm?[/color]

Another option though you’d obviously then need to recreate.

Either way you should also check file and directory ownerships and reset
as necessary.[/color]

I prefer using the ‘getent’ command to get lists of users and groups
because it checks more than just the local files, which is useful in many
environments where you are connected via, for example, LDAP:

getent passwd | grep ':21006:'
getent group | grep ':100:'


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below.

If you want to send me a private message, please let me know in the
forum as I do not use the web interface often.