Answers:
您可以查看Launchpad上的Fingerprint集成页面,其中包含有关指纹读取器的所有信息,以查看您的指纹读取器是否受支持以及如何在Ubuntu上使用它。
首先,检查硬件的兼容性。
其次,请理解通过指纹识别AKIK登录有时是不可靠的。
fprint并非完全稳定,并且可能无法始终运行。
这篇文章的其余部分是从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 <thimo.kraemer@joonis.de>
#
# 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()