pam: Haskell binding for C PAM API

[ authentication, bsd3, library, system ] [ Propose Tags ]

This package provides PAM interface for Haskell programs. See the README on GitHub at see the README on GitHub at < for more information. Unfortunately the Haddock is not working on Hackage. For Haddock see

[Skip to Readme]



  • System
    • Posix
      • System.Posix.PAM
        • System.Posix.PAM.Internals
        • System.Posix.PAM.LowLevel
        • System.Posix.PAM.Types


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS] 0.1,
Change log
Dependencies base (>=4 && <5) [details]
License BSD-3-Clause
Copyright (c) 2011 Evgeny Tarasov (c) 2020 Oscar Harris
Author Evgeny Tarasov <>
Maintainer Oscar Harris <>
Revised Revision 1 made by OscarH at 2020-10-27T13:58:59Z
Category System, Authentication
Home page
Bug tracker
Source repo head: git clone
Uploaded by OscarH at 2020-07-01T19:58:05Z
Distributions NixOS:
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 1454 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user [build log]
All reported builds failed as of 2020-07-01 [all 2 reports]

Readme for pam-

[back to package description]


Haskell CI Hackage

Haskell bindings for PAM. Note that this does not currently include the required bindings to write PAM modules


To authenticate a user test using the system-local-login PAM configuration:

authenticate "system-local-login" "test" "PASSWORD"

To check if a user test exists using the system-auth PAM configuration:

checkAccount "system-auth" "test"

If the operation was successful then PamSuccess will be returned, otherwise PamCode a, where a represents the reason for the failure.

pamCodeToMessage, pamCodeToCDefine and pamCodeDetails can be used to get further details about the response, and isSuccess can be used to check if the operation was successful. See the Haddock documentation for more details on these functions.


The documentation is available on Hackage

Changes in v0.2.0.0:

  • authenticate function now returns MonadIO m => m PamRetCode rather than IO (Either Int ())
  • authSuccess :: PamRetCode -> Bool added which checks if the given PamRetCode is PamSuccess or not
  • whenSuccess :: MonadIO m => PamRetCode -> m PamRetCode -> m PamRetCode added, which returns the second argument if the given response code is PamSuccess, otherwise it returns the given response code (useful for continuing only if the PAM action succeeded).
  • pamCodeToMessage, pamCodeToCDefine and pamCodeDetails now take a PamRetCode rather than an Int
  • checkAccount function has now been implemented

Planned Changes:

  • Document and refactoring the code (started)
  • Add ability to give multiple passwords (for 2FA systems) (see #2)
  • Add functions that do the prompting rather than being given details - useful as if a program using the library is intended to be distributed the number of prompts will not be known (see #3)
  • Add functions to allow writing PAM modules in Haskell (see #8)


See here for more information