As per manual of
groups cmd, there should be username as argument:
Code:
SYNOPSIS
groups [ user ... ]
Else it will return groups of logged in user, not the groups of any other user like mary.
Code:
[root@james]# groups ## It will return groups of root
[mary@james]# groups ## It will return groups of mary
So in order to check groups of user mary, when logged in as root, do:
Code:
[root@james]# groups mary
Alternatively, it's better to use
id cmd:
Code:
[root@james]# id -a username
[root@james]# id -a mary
It will not only return groups but corresponding group ids as well.