List of users from command line

Matthew Carpenter matt
Mon Jan 3 14:05:39 PST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bunch o' show-offs  :)


Brad De Vries wrote:
| On Mon, 3 Jan 2005 11:30:55 -0500, David Bandel
<david.bandel at gmail.com> wrote:
|
|>On Mon, 03 Jan 2005 10:20:15 -0500, Matthew Carpenter <matt at eisgr.com>
wrote:
|>
|>>-----BEGIN PGP SIGNED MESSAGE-----
|>>Hash: SHA1
|>>
|>># getent passwd
|>
|>if you only want user accounts, and they're all between 500-999:
|>getent passwd | cut -f1,3 -d: - | grep [5-9].. - | cut -f1 -d: -
|>add -v to the grep to get system accounts
|>
|>likewise, if your user accounts are 1000+ use:
|>getent passwd | cut -f1,3 -d: - | grep [1-9]... - | cut -f1 -d: -
|>
|>The above can be refined even more, but that should give you the idea.
|>
|>There are similar tricks to get lists of those with null passwords, etc.
|>
|>
|>>This should work for virtually any form of authentication you use.  This
|>>has been tested and proven with compat, LDAP and Winbind
|>>Chong Yu Meng wrote:
|>>| Hi All,
|>>|
|>>| Another elementary question for the gurus on this list :
|>>|
|>>| I need to get a list of user accounts on a server, and though I know I
|>>| can probably do it using webmin or graphical tools, I am specifically
|>>| looking for a command that will do this for me. Can someone help?
|>>|
|>>| Thanks in Advance !
|>
|>Ciao,
|>
|>David A. Bandel
|>--
|>Focus on the dream, not the competition.
|>            - Nemesis Air Racing Team motto
|
|
| Or, if you like awk, you could use:
| getent passwd | awk -F: '{if (($3 >= 500) && ($3 <= 999)) {print $1}}'
|
| This will provide the user name only.  If you'd like to see the real
| name as well (with a tab separator,) change the print command to
| {print $1,"\t",$5}
|
| Brad.
| _______________________________________________
| Linux-users mailing list
| Linux-users at linux-sxs.org
| http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
|
| Need to chat further on this subject? Check out #linux-users on
irc.linux-sxs.org !
|
|
|

- --
Matthew Carpenter
matt at eisgr.com                          http://www.eisgr.com/

Enterprise Information Systems
* Network Server Appliances
* Security Consulting, Incident Handling & Forensics
* Network Consulting, Integration & Support
* Web Integration and E-Business
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB2Zjmso9lqh4MragRAtSKAKC4RUu8B53k+OEDk8I1vQHHUSZQ/wCg2whN
8XKtnBenYtKrKNte6np1bGE=
=UPH4
-----END PGP SIGNATURE-----



More information about the Linux-users mailing list