我的 HP Probook 笔记本电脑上有指纹扫描仪。我在其上运行 Ubuntu 11.10。我如何使用它?
答案1
您可以查看Launchpad 上的指纹集成页面,其中包含有关指纹读取器的所有信息,以查看您的指纹读取器是否受支持以及如何在 Ubuntu 上使用它。
答案2
首先,检查硬件的兼容性。
其次,请理解通过指纹识别 AKIK 登录有时不可靠。
fprint 并不完全稳定,可能无法一直工作。
来自 Ubuntu 论坛
本文其余内容摘自Ubuntu 论坛上的这篇文章。
我个人没有用过,但它是我能找到的最新的 Ubuntu 教程。你可能需要调试gksu.py
包装器脚本
要配置您的设备:
安装 fprint
sudo apt-get install fprint-demo libfprint-dev libfprint0 libpam-fprint aes2501-wy
接下来,使用终端或图形用户界面注册您的手指。
终端
pam_fprint_enroll
图形化
fprint_demo
接下来,配置 PAM,以便指纹读取器可以使用。
gksu gedit /etc/pam.d/common-auth
将其添加到文件顶部(无论您想允许多少次尝试,都可以多次执行此操作)
# Fingerprint only
auth sufficient pam_fprint.so
或者,如果您需要指纹和密码,请使用这些选项。
# Fingerprint + password
auth required pam_fprint.so
对于使用 gksudo/gksu 的程序,复制下面的包装器gksu.py
以/usr/local/bin/gksu
添加指纹支持,并输入以下代码
sudo mv ./gksu.py /usr/local/bin/gksu
sudo chmod 755 /usr/local/bin/gksu
sudo apt-get install python-gnome2-extras python-pexpect
gksu.py
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# gksu wrapper, supporting fprint - v 0.2
#
# Copyright 2008 Thimo Kraemer <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
import sys, time
import subprocess, pexpect
import gtk, gksu2
gksu_cmd = ['/usr/bin/gksu']
sudo_cmd = ['/usr/bin/sudo']
# Do not handle requests just asking for a password or using su
skip = False
arg_skip = ['-w', '--su-mode', '-p', '--print-pass']
for arg in sys.argv:
if arg in arg_skip:
skip = True
break
if skip or len(sys.argv) == 1:
proc = subprocess.Popen(gksu_cmd + sys.argv[1:])
proc.wait()
sys.exit(0)
# Simple message box asking for the fingerprint
class InfoBox(gtk.MessageDialog):
def __init__(self):
gtk.MessageDialog.__init__(
self,
parent = None,
flags = gtk.DIALOG_DESTROY_WITH_PARENT,
type = gtk.MESSAGE_INFO,
buttons = gtk.BUTTONS_NONE,
message_format = ' Fingerprint requested ')
self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_SPLASHSCREEN)
self.set_position(gtk.WIN_POS_CENTER)
self.set_image(gtk.image_new_from_stock(gtk.STOCK_DIALOG_AUTHENTICATION, gtk.ICON_SIZE_DIALOG))
self.format_secondary_text('')
def fade(self, msg=None):
self.hide_all()
if msg:
self.format_secondary_text(msg)
self.show_all()
time.sleep(0.1)
while gtk.events_pending():
gtk.main_iteration()
infobox = InfoBox()
# Prepare gksu context
gksu_context = gksu2.Context()
if '-d' in sys.argv or '--debug' in sys.argv:
print 'Prepare gksu context'
debug = True
else:
debug = False
gksu_context.set_debug(debug)
if '-D' in sys.argv or '--description' in sys.argv:
try: i = sys.argv.index('-D')
except ValueError: i = sys.argv.index('--description')
gksu_context.set_description(sys.argv[i+1])
else:
gksu_context.set_description(sys.argv[-1])
if '-m' in sys.argv or '--message' in sys.argv:
try: i = sys.argv.index('-m')
except ValueError: i = sys.argv.index('--message')
gksu_context.set_message(sys.argv[i+1])
if '-g' in sys.argv or '--disable-grab' in sys.argv:
gksu_context.set_grab(False)
else:
gksu_context.set_grab(True)
if '-P' in sys.argv or '--prompt' in sys.argv:
# No context method defined for this argument
pass
# Create sudo command
if debug:
print 'Create sudo command'
sudo_cmd.append('-S')
sudo_cmd.append('-p')
sudo_cmd.append('GNOME_SUDO_PASS')
if '-u' in sys.argv or '--user' in sys.argv:
try: i = sys.argv.index('-u')
except ValueError: i = sys.argv.index('--user')
sudo_cmd.append('-u')
sudo_cmd.append(sys.argv[i+1])
if not ('-k' in sys.argv or '--preserve-env' in sys.argv):
sudo_cmd.append('-H')
sudo_cmd.append('--')
sudo_cmd.append(sys.argv[-1])
# Interact with sudo
if debug:
print 'Run sudo:', ' '.join(sudo_cmd)
sudo = pexpect.spawn(sudo_cmd[0], sudo_cmd[1:])
while sudo.isalive():
response = sudo.expect([
pexpect.EOF,
pexpect.TIMEOUT,
'Scan .*',
'GNOME_SUDO_PASS',
'.+',
])
# EOF, TIMEOUT
if response <= 1:
continue
if debug:
print '[sudo] ', sudo.after.strip()
# Hide infobox
infobox.fade()
# Ask for fingerprint
if response == 2:
msg = sudo.after.strip()
infobox.fade(msg)
# Ask for password
elif response == 3:
try:
pw = gksu2.ask_password_full(gksu_context, 'Password: ')
except:
pw = ''
sudo.sendline(pw)
infobox.destroy()