unix-2.4.0.1: POSIX functionalitySource codeContentsIndex
System.Posix.User
Portabilitynon-portable (requires POSIX)
Stabilityprovisional
Maintainerlibraries@haskell.org
Contents
User environment
Querying the user environment
The group database
The user database
Modifying the user environment
Description
POSIX user/group support
Synopsis
getRealUserID :: IO UserID
getRealGroupID :: IO GroupID
getEffectiveUserID :: IO UserID
getEffectiveGroupID :: IO GroupID
getGroups :: IO [GroupID]
getLoginName :: IO String
getEffectiveUserName :: IO String
data GroupEntry = GroupEntry {
groupName :: String
groupPassword :: String
groupID :: GroupID
groupMembers :: [String]
}
getGroupEntryForID :: GroupID -> IO GroupEntry
getGroupEntryForName :: String -> IO GroupEntry
getAllGroupEntries :: IO [GroupEntry]
data UserEntry = UserEntry {
userName :: String
userPassword :: String
userID :: UserID
userGroupID :: GroupID
userGecos :: String
homeDirectory :: String
userShell :: String
}
getUserEntryForID :: UserID -> IO UserEntry
getUserEntryForName :: String -> IO UserEntry
getAllUserEntries :: IO [UserEntry]
setUserID :: UserID -> IO ()
setGroupID :: GroupID -> IO ()
User environment
Querying the user environment
getRealUserID :: IO UserIDSource
getRealUserID calls getuid to obtain the real UserID associated with the current process.
getRealGroupID :: IO GroupIDSource
getRealGroupID calls getgid to obtain the real GroupID associated with the current process.
getEffectiveUserID :: IO UserIDSource
getEffectiveUserID calls geteuid to obtain the effective UserID associated with the current process.
getEffectiveGroupID :: IO GroupIDSource
getEffectiveGroupID calls getegid to obtain the effective GroupID associated with the current process.
getGroups :: IO [GroupID]Source
getGroups calls getgroups to obtain the list of supplementary GroupIDs associated with the current process.
getLoginName :: IO StringSource
getLoginName calls getlogin to obtain the login name associated with the current process.
getEffectiveUserName :: IO StringSource
getEffectiveUserName gets the name associated with the effective UserID of the process.
The group database
data GroupEntry Source
Constructors
GroupEntry
groupName :: StringThe name of this group (gr_name)
groupPassword :: StringThe password for this group (gr_passwd)
groupID :: GroupIDThe unique numeric ID for this group (gr_gid)
groupMembers :: [String]A list of zero or more usernames that are members (gr_mem)
show/hide Instances
getGroupEntryForID :: GroupID -> IO GroupEntrySource
getGroupEntryForID gid calls getgrgid to obtain the GroupEntry information associated with GroupID gid.
getGroupEntryForName :: String -> IO GroupEntrySource
getGroupEntryForName name calls getgrnam to obtain the GroupEntry information associated with the group called name.
getAllGroupEntries :: IO [GroupEntry]Source
getAllGroupEntries returns all group entries on the system by repeatedly calling getgrent
The user database
data UserEntry Source
Constructors
UserEntry
userName :: StringTextual name of this user (pw_name)
userPassword :: StringPassword -- may be empty or fake if shadow is in use (pw_passwd)
userID :: UserIDNumeric ID for this user (pw_uid)
userGroupID :: GroupIDPrimary group ID (pw_gid)
userGecos :: StringUsually the real name for the user (pw_gecos)
homeDirectory :: StringHome directory (pw_dir)
userShell :: StringDefault shell (pw_shell)
show/hide Instances
getUserEntryForID :: UserID -> IO UserEntrySource
getUserEntryForID gid calls getpwuid to obtain the UserEntry information associated with UserID uid.
getUserEntryForName :: String -> IO UserEntrySource
getUserEntryForName name calls getpwnam to obtain the UserEntry information associated with the user login name.
getAllUserEntries :: IO [UserEntry]Source
getAllUserEntries returns all user entries on the system by repeatedly calling getpwent
Modifying the user environment
setUserID :: UserID -> IO ()Source
setUserID uid calls setuid to set the real, effective, and saved set-user-id associated with the current process to uid.
setGroupID :: GroupID -> IO ()Source
setGroupID gid calls setgid to set the real, effective, and saved set-group-id associated with the current process to gid.
Produced by Haddock version 2.6.1