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.
cat /etc/passwd.getent passwdshould 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 ofgrep passwd /etc/nsswitch.confgetent passwd <specific-user>will work but that user wouldn't show up in a baregetent passwd.