Chapter 35. Information from System Databases
Information About Users
In list context, each of these routines returns a list of values. Use the standard module User::pwent
for by-name access to the elements of the list:
Index | Name | Description |
---|---|---|
0 | name | User name |
1 | passwd | Password info |
2 | uid | Id of this user |
3 | gid | Group id of this user |
4 | quota | Quota information |
5 | comment | Comments |
6 | gecos | Full name |
7 | dir | Home directory |
8 | shell | Login shell |
9 | expire | Password expiration info |
- endpwent
Ends lookup processing.
- getpwent
Gets next user information. In scalar context, returns the username.
- getpwnam name
Gets information by name. In scalar context, returns the user id.
- getpwuid uid
Gets information by user id. In scalar context, returns the username.
- setpwent
Resets lookup processing.
Get Perl Pocket Reference, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.