Categories
Ubuntu

/lib/security/privacyidea_pam.py – ImportError: No module named requests

Issue reported at https://github.com/privacyidea/pam_python/issues/17

Oct 23 16:58:36 login1 /lib/security/privacyidea_pam.py[27617]: Traceback (most recent call last):
Oct 23 16:58:36 login1 /lib/security/privacyidea_pam.py[27617]:   File "/lib/security/privacyidea_pam.py", line 43, in <module>
Oct 23 16:58:36 login1 /lib/security/privacyidea_pam.py[27617]:     import requests
Oct 23 16:58:36 login1 /lib/security/privacyidea_pam.py[27617]: ImportError: No module named requests
Oct 23 16:58:36 login1 sshd-2222[27613]: error: PAM: Error in service module for shanker from x.x.x.x

Quick Fix:

$ sudo vi /lib/security/privacyidea_pam.py
# Add the below lines to the top (as suggested in the Github issue) ~line #42
import site
site.main()

File contents now like like this after editing

import site
site.main()
import json
import requests
import syslog
import sqlite3
import passlib.hash
import time
import traceback

By Shanker Balan

Shanker Balan is a devops and infrastructure freelancer with over 14 years of industry experience in large scale Internet systems. He is available for both short term and long term projects on contract.

Please use the Contact Form for any enquiry.

Leave a Reply

Your email address will not be published. Required fields are marked *