1python-pam
2==========
3
4Python pam module supporting py3 (and py2)
5
6Commandline example:
7
8```
9[david@Scott python-pam]$ python pam.py
10Username: david
11Password:
120 Success
13
14[david@Scott python-pam]$ python2 pam.py
15Username: david
16Password:
170 Success
18```
19
20Inline examples:
21```
22[david@Scott python-pam]$ python
23Python 3.4.1 (default, May 19 2014, 17:23:49)
24[GCC 4.9.0 20140507 (prerelease)] on linux
25Type "help", "copyright", "credits" or "license" for more information.
26>>> import pam
27>>> p = pam.pam()
28>>> p.authenticate('david', 'correctpassword')
29True
30>>> p.authenticate('david', 'badpassword')
31False
32>>> p.authenticate('david', 'correctpassword', service='login')
33True
34>>> p.authenticate('david', 'correctpassword', service='unknownservice')
35False
36>>> p.authenticate('david', 'correctpassword', service='login', resetcreds=True)
37True
38>>> p.authenticate('david', 'correctpassword', encoding='latin-1')
39True
40>>> print('{} {}'.format(p.code, p.reason))
410 Success
42>>> p.authenticate('david', 'badpassword')
43False
44>>> print('{} {}'.format(p.code, p.reason))
457 Authentication failure
46>>>
47```
48