fprint
来自fprint项目主页的简介:
- The fprint project aims to add support for consumer fingerprint reader devices, in Linux, as well as other free Unices.
- (fprint项目的目标是在Linux和其他自由Unice中增加对消费级指纹读取器设备的支持。)
这个想法是在一些支持内置指纹识别器的笔记本中使用 PAM 登录。此教程还将介绍如何使用常规密码作为备用登录的方法(由于某些原因,不建议仅使用指纹模块进行验证登录)。
使用前提[编辑 | 编辑源代码]
首先需要您的设备上有兼容的指纹识别设备, 可以查看兼容设备清单来确定是否支持您的指纹识别设备。 使用下面命令查看您的指纹设备信息:
$ lsusb
安装[编辑 | 编辑源代码]
安装 软件包 fprintd包 。 也可能需要软件包imagemagick包.
Some devices require a different fork of libfprint包 specifically made for touch-based sensors and not (yet?) merged with the main libfprint: libfprint-tod. This is available as libfprint-tod-gitAUR. If you have a 04f3:0c4c or a 04f3:0c00 use the experimental package libfprint-elanmoc2-newdrvs-gitAUR from libfprint-elanmoc2-newdrvs waiting to be merged into libfprint-elanmoc2 which is also waiting to be merged into the main libfprint.
配置[编辑 | 编辑源代码]
登录配置[编辑 | 编辑源代码]
将pam_fprintd.so
模块添加在/etc/pam.d/system-local-login
文件 auth 字段的最顶端。
/etc/pam.d/system-local-login
auth sufficient pam_fprintd.so auth include system-login ...
这会首先尝试使用指纹登录,如果失败或在给定用户的主目录中找不到指纹数据,则继续进行密码登录。
你也可以用同样的方式修改 /etc/pam.d/{login,su,sudo,gdm,lightdm}
中的其他文件, 例如 /etc/pam.d/polkit-1
用于 GNOME polkit 身份验证或 /etc/pam.d/kde
解锁KDE的锁屏
当完成录入指纹时,将 pam_fprintd.so
添加到 /etc/pam.d/
中的任何配置文件中只会提示进行指纹身份验证。如果无法按 Ctrl+c
指纹身份验证(由于缺少外壳),这将防止使用密码。要在图形界面中使用密码或指纹,请将以下行添加到所需文件的最顶部:
auth sufficient pam_unix.so try_first_pass likeauth nullok auth sufficient pam_fprintd.so ...
这里会提示输入密码;在空白字段上按 Enter
将继续进行指纹身份验证。
如果要同时提示输入指纹和密码,可以使用 pam-fprint-grosshackAUR。对于某些不允许空白密码输入的图形程序,例如 Gnome 的内置 polkit 代理,可能需要这样做。若要使用此包,请将以下行添加到所需任何文件的顶部:
auth sufficient pam_fprintd_grosshack.so auth sufficient pam_unix.so try_first_pass nullok ...
录入指纹[编辑 | 编辑源代码]
您需要运行Authentication-agent才能录入。
开始录入指纹,请运行:
$ fprintd-enroll
或为所有手指录入指纹:
$ fprintd-delete "$USER" $ for finger in {left,right}thumb,{index,middle,ring,littlefinger}; do fprintd-enroll -f "$finger" "$USER"; done
您将被要求扫描给定的手指。用右手食指滑动“五次”。之后,在 /var/lib/fprint/
中创建指纹数据。
您也可以在没有身份验证代理的情况下注册:
# fprintd-enroll user
验证指纹[编辑 | 编辑源代码]
如果您需要验证录入的指纹能否正确识别,请运行以下命令:
$ fprintd-verify
删除指纹[编辑 | 编辑源代码]
如果您不满意已录入的指纹数据,例如需要删除左手拇指指纹数据,可以使用下面命令进行删除:
$ fprintd-delete -f left-thumb
有关更多信息,请参阅 fprintd(1).
限制用户录入指纹[编辑 | 编辑源代码]
默认情况下,允许每个用户注册新指纹,而无需提示输入密码或指纹。您可以使用 polkit 规则更改此行为。
有两个位置包含 polkit 配置文件
/etc/polkit-1/rules.d/
/usr/share/polkit-1/rules.d/
/usr/share/polkit-1/rules.d/
目录下的文件,因为该目录下的文件在程序更新时将会被覆盖,您应该复制文件到 /etc/polkit-1/rules.d/
目录。在以下示例中,只有 root 可以录入指纹:
/etc/polkit-1/rules.d/50-net.reactivated.fprint.device.enroll.rules
polkit.addRule(function (action, subject) { if (action.id == "net.reactivated.fprint.device.enroll") { return subject.user == "root" ? polkit.Result.YES : polkit.Result.NO } })
故障排除[编辑 | 编辑源代码]
No devices available[编辑 | 编辑源代码]
如果您在 兼容设备清单 没有找到您的设备, 请通过journal查看fprintd.service
的日志信息。
您可能会可能到如下日志条目:
fprintd[2936592]: Corrupted message received fprintd[2936592]: Ignoring device due to initialization error: unsupported firmware version
确保设备的固件是最新的 Fwupd。
Not Authorized: net.reactivated.fprint.device.enroll[编辑 | 编辑源代码]
如果您在录入指纹的时候提示类似下面信息:
Using device /net/reactivated/Fprint/Device/0 Enrolling right-index-finger finger. EnrollStart failed: GDBus.Error:net.reactivated.Fprint.Error.PermissionDenied: Not Authorized: net.reactivated.fprint.device.enroll
这是因为polkit策略的限制,可以尝试在/usr/share/polkit-1/rules.d/
添加一条策略reactivated.fprint.device.verify.rules
,以下实例中允许users
用户组可以使用指纹识别器:
/etc/polkit-1/rules.d/reactivated.fprint.device.verify.rules
polkit.addRule(function (action, subject) { if (action.id == "net.reactivated.fprint.device.enroll" && subject.isInGroup("users")) { return polkit.Result.YES } })