使用 python 3 对 Linux 中的用户进行身份验证

发布于 2024-10-03 03:54:40 字数 217 浏览 1 评论 0原文

我编写了需要使用 Linux 用户名和密码对用户进行身份验证的程序。我认为这应该与 PAM 有关。我尝试从 google PAM 模块搜索 python3,但没有找到。是否有现成的 PAM 库,或者尝试制作我自己的库? PAM 使用是否存在一些需要考虑的特殊安全风险?

我知道我可以使用 python3 spwd 类对用户进行身份验证,但我不想使用它,因为那样我必须使用 root 访问权限运行我的程序。

I wrote the program that would need to authenticate users using their Linux usernames and passwords. I think it should do with PAM. I have tried searching from google PAM module for python3, but I did not find any. Is there a ready to use the PAM libraries, or try to make my own library? Is PAM usage some special security risks that should be taken into?

I know that I can authenticate users with python3 spwd class but I dont want to use that, because then I have to run my program with root access.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

财迷小姐 2024-10-10 03:54:41

+che

您链接到的python pam模块与python3不兼容。我知道三个 pam 模块 {'pam'、'pypam'、'spypam'},但没有一个与 py3 兼容。

我已经修改了 Chris AtLee 的原始 pam 包以与 python3 一起使用。在反馈给他之前先清理一下

+che

the python pam module you linked to is not python3 compatible. there are three pam modules that i'm aware of {'pam', 'pypam', 'spypam'}, and none are py3 compatible.

i've modified Chris AtLee's original pam package to work with python3. cleaning it up a bit before feeding back to him

提赋 2024-10-10 03:54:40

有点晚了,但我想我可以发布这个供用户通过 Google 查找:

有一个该模块的 python3 版本,我在 https://github.com/leonnnn/python3-simplepam。命名与 python2 版本不同,以避免与名为 python3-pam 的 Ubuntu 软件包混淆,但除了名称之外,它与 Chris AtLee 的模块相同。

在 Fedora 19 及更高版本中,还可以通过 yum 安装 python3-simplepam 模块。

A bit late, but I thought I might post this for users to find via Google:

There’s a python3 version of said module which I maintain at https://github.com/leonnnn/python3-simplepam. The naming is different from the python2 version to avoid confusion with an Ubuntu package called python3-pam, but apart from the name, it’s the same as Chris AtLee’s module.

The python3-simplepam module is also available for installation via yum in Fedora 19 and later.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文