How to find all people's username in company's /home dir

0

In my company we all have home directory /home/user, I want to test other users' initialization settings, but in /home dir, normally I can only see my own user name. However if I know other peoples' user name, sometimes also one or two other person, I can access to their /home/otheruser.

So the problem comes down to the point that I have to know their user name first. I want to try to traverse alpabet combinations [a-z] with if [ -d "/home/asuer"]; then testinitializesetting; fi. But the set is too large and technically impossible. Does anybody know how to list all usernames even if they are accessible but not displayed? Besides, ls -a in /home dir also not working.

seektrue

Posted 2016-11-20T12:19:57.090

Reputation: 3

What sort of login scheme are you using? LDAP or NIS or something like that? – Eric Renouf – 2016-11-20T12:22:32.470

Answers

1

You should probably be able to run getent passwd to get a list of every passwd entry in the system. Then you can grab the first field, like

getent passwd | cut -f1 -d:

but that will also include system accounts so more than just "regular" users

Eric Renouf

Posted 2016-11-20T12:19:57.090

Reputation: 1 548