來自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 ...
錄入指紋
您需要運行 Polkit 身份認證組件 才能錄入。
開始錄入指紋,請運行:
$ 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 } })