Usermod doesn't work on root

Hi, I am root user. I need to add more groups to the account. I usse the below command but no apparent result

[root@hostname ~]# id
uid=0(root) gid=0(root) groups=0(root)
[root@hostname ~]# usermod -a -G 302,301,303 root
[root@hostname ~]# id
uid=0(root) gid=0(root) groups=0(root)
[root@hostname ~]#

What can be the reason?

The name service cache daemon might interfere. Try to clear the cache with

nscd -i group
nscd -i passwd

---------- Post updated at 12:10 ---------- Previous update was at 12:05 ----------

Ah, and you should logout and login again, of course :wink:

[root@hostname ~]# nscd -i group
[root@hostname ~]# id
uid=0(root) gid=0(root) groups=0(root)

Unfortunately issue is still there.

logged out and back on with root and user still doesn't have gruops.

admin:/root # id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
admin:/root # id root
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
admin:/root # usermod -a -G 72 root
admin:/root # id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
admin:/root # id root
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),72(tcpdump)
admin:/root # exit
admin:/home/hergp $ sudo -i
admin:/root # id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),72(tcpdump)

"sudo -i" didn't switch user. I tried the rest - unfortunately no luck.

[root@hostname bin]# id
uid=0(root) gid=0(root) groups=0(root)
[root@hostname bin]# usermod -a -G 301,303,302 root
[root@hostname bin]# id root
uid=0(root) gid=0(root) groups=0(root)
[root@hostname bin]# exit
logout
tmproot@hostname>sudo -i [here it didn't switch to root]
tmproot@hostname>su - root
[root@hostname ~]# id
uid=0(root) gid=0(root) groups=0(root)

I wonder if this could be because of any puppet or LDAP setting?

Try adding the groups using the -a option to gpasswd.

This one fails saying the group I want to add doesn't exist in /etc/group
Actually this gives the clue that most of our groups and account are created in LDAP. I think the reason I can't add root user to additional group because they don't locally exist on the host.