Ubuntu

在蓋子行為上切換密碼/指紋認證

  • January 18, 2022

我將指紋身份驗證設置為登錄和 sudo 命令的預設值。在 3 次失敗或 10 秒內未檢測到指紋時,需要密碼驗證。當蓋子關閉(外部顯示器)時,指紋感測器被阻止(物理上),我不想每次都等待 10 秒才能詢問密碼。有沒有辦法根據蓋子狀態來實現身份驗證類型的更改。

現在使用 Ubuntu 20.04 / Gnome 指紋感測器:138a:0097 Validity Sensors (Thinkpad T470)

$$ UPDATE $$

santiago@thinkpad-t470 $ cat  /etc/pam.d/common-auth 
#
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.).  The default is to use the
# traditional Unix authentication mechanisms.
#
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules.  See
# pam-auth-update(8) for details.

# here are the per-package modules (the "Primary" block) auth   [success=2 default=ignore]  pam_fprintd.so max_tries=1 timeout=10
# debug auth    [success=1 default=ignore]  pam_unix.so nullok try_first_pass
# here's the fallback if no module succeeds auth    requisite           pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around auth   required            pam_permit.so
# and here are more per-package modules (the "Additional" block) auth   optional            pam_cap.so 
# end of pam-auth-update config

我不使用 Ubuntu,但您應該可以通過更改/etc/pam.d/common-auth.

試試這個(使用升級的權限):

echo "auth  [success=2 default=ignore]  pam_fprintd.so max_tries=1 timeout=3" >> /etc/pam.d/common-auth

計時器現在設置為三秒。當然,您可以將該值更改為您想要的任何值。

如果由於某種原因它不起作用,請使用以下內容編輯文件:

   auth    [success=2 default=ignore]  pam_fprintd.so max_tries=1 timeout=3
   auth    [success=1 default=ignore]  pam_unix.so nullok_secure try_first_pass
   auth    requisite           pam_deny.so
   auth    required            pam_permit.so

引用自:https://unix.stackexchange.com/questions/684299