1

I want to get list of users - both human and machine who have access to the unix server. OS is:

NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"

I tried cat /etc/passwd and getent passwd - but both these lists are incomplete. A number of users that have a folder in /home are not present in output of either of the above two commands.

I ran id <username> for a username that had a folder but not present in the output of these commands and I got a valid output, proving that that user exists.

So, how do I get a list of "all" users of the server.
PS: I do have sudo access.

Output of

~> grep passwd /etc/nsswitch.conf
passwd:     files sss

EDIT1: I did some digging and turns out this server uses IPA. I ran ipa user-find. It listed 2K users, which I believe is the exhaustive list of users that are created via IPA but not necessarily all of them have access to this particular server.

More Background:
Most human users login via either SSH or id + password.
This server is not maintined by any IT/Server team; the business users own the server. People without deep knowledge of servers and systems maintain create users on it. I recently got sudo access and need to 'clean up' the server a little bit - delete users who no longer should have access, identify data that can be archived etc., create proper unix groups to segregate access to data.

8
  • 1
    What do you mean by "all users of the server". The users who have logged into it? The users who have access to log in? How are the users authenticating? Is it via LDAP? What do you mean by "both of these lists are incomplete"? I believe the fist command that you ran is actually cat /etc/passwd. Commented Jun 3, 2021 at 15:06
  • I need list of users who have access to login. Yes, it is cat /etc/passwd. By incomplete i mean that users listed in the output of these commands are not the only ones that have login access. I know for sure there are other users having access. Commented Jun 3, 2021 at 15:07
  • How do they log in? SSH? FTP? SFTP? A 3rd-party application? Commented Jun 3, 2021 at 15:58
  • 3
    getent passwd should list all valid users in a properly configured system, whether they come from /etc/passwd or some other authentication database (like ldap or nis or some other libnss-* module). please edit your question and add the output of grep passwd /etc/nsswitch.conf Commented Jun 3, 2021 at 16:10
  • 1
    @cas nit: it's possible to have enumeration disabled in sssd+LDAP, so getent passwd <specific-user> will work but that user wouldn't show up in a bare getent passwd. Commented Jun 4, 2021 at 6:21

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.