7.4. 配置智能卡认证,使它在取出智能卡时进行锁定

authselect 服务可让您配置智能卡验证,以便在从读取器中删除智能卡后立即锁定屏幕。authselect 命令必须包括以下变量:

  • with-smartcard — 启用智能卡验证
  • with-smartcard-required  - 启用专用智能卡验证(禁用密码验证)
  • with-smartcard-lock-on-removal — 在智能卡被取出后会强制登出

    注意

    with-smartcard-lock-on-removal 选项仅适用于具有 GNOME 桌面环境的系统。如果您使用基于 tty 或控制台的系统,并且您从读卡器中删除了智能卡,则不会将您自动锁在系统之外。

先决条件

  • 智能卡包含您的证书和私钥。
  • 在读卡器中插入卡并连接到计算机。
  • authselect 工具安装在您的本地系统中。

步骤

  • 输入以下命令启用智能卡验证、禁用密码验证并在删除时强制锁定:

    # authselect select sssd  with-smartcard  with-smartcard-required with-smartcard-lock-on-removal --force

现在,当您取出卡时,屏幕会锁定。您必须重新插入智能卡来解锁它。