Next: , Previous: , Up: Library   [Contents][Index]


5.29 System User Database

Built-in Function: string getpwnam (string name)
Built-in Function: string getpwuid (number uid)

Look for the user name (getpwnam) or user ID uid (getpwuid) in the system password database and return the corresponding record, if found. If not found, raise the ‘e_not_found’ exception.

The returned record consists of six fields, separated by colon sign:

uname:passwd:uid:gid:gecos:dir:shell
FieldMeaning
unameuser name
passwduser password
uiduser ID
gidgroup ID
gecosreal name
dirhome directory
shellshell program

For example:

getpwnam("gray")
⇒ "gray:x:1000:1000:Sergey Poznyakoff:/home/gray:/bin/bash"

Following two functions can be used to test for existence of a key in the user database:

Built-in Function: boolean mappwnam (string name)
Built-in Function: boolean mappwuid (number uid)

Return ‘true’ if name (or uid) is found in the system user database.