Ran below commands to create a group

[root@u87 ~] # groupadd -g 2441 somegroup
groupadd: group 'somegroup' already exists
[root@u87 ~]# cat /etc/group | grep somegroup
[root@u87 ~]#
[root@u87 ~]#
[root@u87 ~]# 
[root@u87 ~]# cat /etc/system-release
Red Hat Enterprise Linux Server release 7.5 (Maipo)

How do I understand this error?


Groups (and other user information) can be defined in places other than /etc/group; e.g. LDAP. The sources of information are configured in /etc/nsswitch.conf.

To retrieve information from whatever sources are used, use getent:

getent group somegroup

You can use this to check the existence of a group before trying to add it:

getent group somegroup || groupadd -g 2441 somegroup
  • how to retrieve information of someuser from LDAP? getent user? – overexchange Sep 19 '18 at 15:12
  • @JeffSchaller getent user someuser does not work. I would like to know the uid – overexchange Sep 19 '18 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.