LnxUser::getUser
Innen: IT documentation
Description
Object-oriented style
public lnxUser::getUser ( string | int $user ): array
Procedural style
lnxGetUser ( string | int $user ): array
Returns informations about the linux user.
Parameters
- user
- Name or User ID of linux user.
Return Values
Returns an array what contains the information about linux user, or false if user is not exists.
Structure of array:
[
- 'name' => string
- Name of linux user.
- 'uid' => int
- User ID of linux user.
'gid'=> int- Primary group ID of linux user.
'comment'=> string- Comment (display name) of linux user.
'home'=> string- Absolute path of Home directory of linux user.
'shell'=> string- Absolute path of shell for linux user.
'groups'=> array- It is a simple indexed array what contains the groups in what the user is member. Note: Contains the primary group too!
'password'=> string- Stored password hash of linux user.
'lastchanged'=> int- Date of last password change of linux user. Format:
timestamp 'min'=> int- The minimum number of days required between password changes
'max'=> int- The maximum number of days the password is valid
'warn'=> int- The number of days before password is to expire that user is warned
'inactive'=> int- The number of days after password expires that account is disabled
'expire'=> int- Date when account will be disabled. Format:
timestamp
]
Changelog
| Version (lnxUser) |
Description |
|---|---|
| 1.00 | available |
Examples
$user = 'testUser';
# Query information about the linux user
print( "Information of '$user' user:" . PHP_EOL );
if ( lnxExistsUser( $user ) )
foreach ( lnxGetUser ( $user ) as $key => $value ) {
print( $key . ' : ' );
if ( is_array( $value ) )
print( implode ( ',', $value ) );
else
print( $value );
print( PHP_EOL );
}