<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dclatot</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dclatot"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Dclatot"/>
	<updated>2026-05-07T23:26:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Script_for_enabling_the_fingerprint_reader_with_BioAPI&amp;diff=20305</id>
		<title>Script for enabling the fingerprint reader with BioAPI</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Script_for_enabling_the_fingerprint_reader_with_BioAPI&amp;diff=20305"/>
		<updated>2006-02-22T19:49:22Z</updated>

		<summary type="html">&lt;p&gt;Dclatot: /* The script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using the [[Integrated Fingerprint Reader|integrated fingerprint reader]] under Linux is currently a fairly complicated [[How to enable the fingerprint reader|process]]. The following script automates the installation of the fingerprint software, for some Linux distributions. It covers most components (bioapi framework, driver, pam_bioapi, PAM setup, USB device permissions pamtester and enrolling), and handles all the downloading, patching and installation.&lt;br /&gt;
&lt;br /&gt;
Usage: just copy into a file and run as root.&lt;br /&gt;
&lt;br /&gt;
After installation, all PAM-enabled system functions will use the fingerprint reader (and if it fails, default to the usual password entry). This includes:&lt;br /&gt;
* KDE's KDM login (enter an empty password, then swipe finger)&lt;br /&gt;
* KDE's screensaver (enter an empty password, then swipe finger)&lt;br /&gt;
* Gnome's GDM login&lt;br /&gt;
* &amp;lt;tt&amp;gt;su&amp;lt;/tt&amp;gt; &lt;br /&gt;
* &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Everything is intalled into {{path|/opt/bioapi}}, so it doesn't pollute your filesystem. The only files affected outside {{path|/opt/bioapi}} are the ldconfig configuration, PAM configuration, {{path|/etc/rc.local}} and a few symlinks in {{path|/lib/security}}.&lt;br /&gt;
&lt;br /&gt;
For details, manual installation and hints for other distributions, see [[How to enable the fingerprint reader]].&lt;br /&gt;
&lt;br /&gt;
===Distributions supported by this script===&lt;br /&gt;
* {{Fedora}} 4&lt;br /&gt;
&lt;br /&gt;
If you add support for additional distributions, please update this script (using conditionals where necessary) instead of branching it.&lt;br /&gt;
&lt;br /&gt;
==The script==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Install UPEK fingerprint reader driver and associated software on Linux systems.&lt;br /&gt;
# Source: http://thinkwiki.org/wiki/Script_for_enabling_the_fingerprint_reader&lt;br /&gt;
&lt;br /&gt;
set -e -E -x -u   # verbose, abort if anything fails&lt;br /&gt;
&lt;br /&gt;
WHERE=/opt/bioapi&lt;br /&gt;
PASSWD_ENROLLS=0   # should &amp;quot;passwd&amp;quot; do fingerprint enrollment (always)?&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install bioapi:&lt;br /&gt;
&lt;br /&gt;
mkdir -p $WHERE&lt;br /&gt;
wget -N http://www.qrivy.net/~michael/blua/bioapi/bioapi-latest.tar.bz2&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
932425e847449e9612c6894dcbaf44630aecfc13  bioapi-latest.tar.bz2&lt;br /&gt;
EOF&lt;br /&gt;
tar xjf bioapi-latest.tar.bz2&lt;br /&gt;
pushd bioapi-1.2.2&lt;br /&gt;
./configure --with-Qt-dir=no --prefix=$WHERE&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
install -m644 include/bioapi_util.h $WHERE/include/bioapi_util.h&lt;br /&gt;
install -m644 include/installdefs.h $WHERE/include/installdefs.h&lt;br /&gt;
install -m644 imports/cdsa/v2_0/inc/cssmtype.h $WHERE/include/cssmtype.h&lt;br /&gt;
chmod o-w $WHERE/var/bioapi&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Tell ldconfig about bioapi libraries:&lt;br /&gt;
&lt;br /&gt;
[ -d /etc/ld.so.conf.d ] || { echo &amp;quot;Unsupported distribution: no /etc/ld.so.conf.d directory.&amp;quot;; exit 1; }&lt;br /&gt;
echo $WHERE/lib &amp;gt; /etc/ld.so.conf.d/bioapi.conf&lt;br /&gt;
ldconfig&lt;br /&gt;
ldconfig -p | grep -q bioapi || { echo &amp;quot;ldconfig doesn't see bioapi&amp;quot;; exit 1; }&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install UPEK driver:&lt;br /&gt;
&lt;br /&gt;
wget -N http://www.upek.com/support/download/TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
c73466b5c3b26415b300d5c5ffb76deaefadeb32  TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
EOF&lt;br /&gt;
mkdir -p driver&lt;br /&gt;
pushd driver&lt;br /&gt;
unzip ../TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
PATH=&amp;quot;$PATH:$WHERE/bin&amp;quot; &lt;br /&gt;
sh install.sh $WHERE/lib/&lt;br /&gt;
cd NonGUI_Sample&lt;br /&gt;
perl -i -pe 'print &amp;quot;#include &amp;lt;stdlib.h&amp;gt;\n//DISABLED: &amp;quot; if m!^#include &amp;quot;port/bioapi_port.h&amp;quot;$!'  main.c&lt;br /&gt;
gcc -o Sample main.c -I$WHERE/include -L$WHERE/lib -lbioapi100 -DUNIX -DLITTLE_ENDIAN&lt;br /&gt;
install Sample -m755 $WHERE/bin/upek-NonGUI_Sample&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
SERIAL=`$WHERE/bin/BioAPITest | sed -ne &amp;quot;/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install (patched) pam_bioapi:&lt;br /&gt;
&lt;br /&gt;
wget -N http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2 &lt;br /&gt;
wget -N http://badcode.de/downloads/fingerprint.patch &lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
a0bdf3436e55f7dc8b4795243f08a4c9b399dec8  pam_bioapi-latest.tar.bz2&lt;br /&gt;
619254a5bcd3acb8bf1d72b15ea69bfe00f0f064  fingerprint.patch&lt;br /&gt;
EOF&lt;br /&gt;
tar xjvf pam_bioapi-latest.tar.bz2 &lt;br /&gt;
pushd pam_bioapi-0.2.1 &lt;br /&gt;
patch -p0 &amp;lt; ../fingerprint.patch &lt;br /&gt;
CPPFLAGS=&amp;quot;-I$WHERE/include&amp;quot; LDFLAGS=&amp;quot;-L$WHERE/lib&amp;quot; ./configure --prefix=$WHERE&lt;br /&gt;
make &lt;br /&gt;
make install &lt;br /&gt;
ln -vfs $WHERE/lib/security/pam_bioapi.so* /lib/security/&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install pamtester:&lt;br /&gt;
&lt;br /&gt;
wget http://mesh.dl.sourceforge.net/sourceforge/pamtester/pamtester-0.1.2.tar.gz&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
33bcc610d7f208b50a0a23c144bdbd1e2cae4ac6  pamtester-0.1.2.tar.gz&lt;br /&gt;
EOF&lt;br /&gt;
tar xzvf pamtester-0.1.2.tar.gz&lt;br /&gt;
pushd pamtester-0.1.2&lt;br /&gt;
./configure --prefix=$WHERE&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Configure pam to use pam_bioapi:&lt;br /&gt;
&lt;br /&gt;
grep -q 'Fedora Core release 4' /etc/redhat-release || { echo \&lt;br /&gt;
  &amp;quot;I don't know how to configure PAM on this distribution.&lt;br /&gt;
   See: http://thinkwiki.org/wiki/How_to_enable_the_fingerprint_reader#Configuring_pam&amp;quot;;&lt;br /&gt;
   exit 1; }&lt;br /&gt;
&lt;br /&gt;
PAMFILE=/etc/pam.d/system-auth&lt;br /&gt;
if ! grep -q 'pam_bioapi\.so' $PAMFILE; then&lt;br /&gt;
  perl -i -pe '&lt;br /&gt;
    if (!$a &amp;amp;&amp;amp; m/^auth.*pam_unix\.so/) {$a=1; print &lt;br /&gt;
      &amp;quot;auth        sufficient    pam_bioapi.so '$SERIAL' /etc/bioapi/pam/\n&amp;quot;}&lt;br /&gt;
    ' $PAMFILE&lt;br /&gt;
  if [ $PASSWD_ENROLLS == 1 ]; then&lt;br /&gt;
    perl -i -pe '&lt;br /&gt;
      if (!$p &amp;amp;&amp;amp; m/^password/) {$p=1; print&lt;br /&gt;
        &amp;quot;password    required      pam_bioapi.so '$SERIAL' /etc/bioapi/pam/\n&amp;quot;}&lt;br /&gt;
      ' $PAMFILE&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# USB permissions (set now and add to startup):&lt;br /&gt;
&lt;br /&gt;
RC_FILE=/etc/rc.local&lt;br /&gt;
SET_PERMS=$WHERE/bin/set_fingerprint_perms&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; $SET_PERMS &amp;lt;&amp;lt;'EOF'&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Make fingerprint reader USB device world-writable:&lt;br /&gt;
chmod -R a+X /proc/bus/usb&lt;br /&gt;
chmod 666 /proc/bus/usb/`/sbin/lsusb | sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`&lt;br /&gt;
EOF&lt;br /&gt;
chmod 755 $SET_PERMS&lt;br /&gt;
&lt;br /&gt;
$SET_PERMS&lt;br /&gt;
&lt;br /&gt;
[ -e $RC_FILE ] || { echo &amp;quot;No $RC_FILE, can't handle this distribution.&amp;quot;; exit 1; }&lt;br /&gt;
if ! grep -q 0483:2016 $SET_PERMS; then&lt;br /&gt;
  echo $SET_PERMS &amp;gt;&amp;gt; $RC_FILE&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Enroll:&lt;br /&gt;
&lt;br /&gt;
mkdir -p /etc/bioapi/pam/$SERIAL&lt;br /&gt;
pushd /etc/bioapi/pam/$SERIAL&lt;br /&gt;
read -p &amp;quot;Now enroll all relevant Unix accounts (press Enter to start).&amp;quot;&lt;br /&gt;
$WHERE/bin/upek-NonGUI_Sample&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Done:&lt;br /&gt;
&lt;br /&gt;
set +x&lt;br /&gt;
cat&amp;lt;&amp;lt;EOF&lt;br /&gt;
&lt;br /&gt;
Success.&lt;br /&gt;
* To test the fingerprint-enabled PAM login, run:&lt;br /&gt;
  $WHERE/bin/pamtester -v login USERNAME authenticate&lt;br /&gt;
* Add the following command to your resume-from-suspend script:&lt;br /&gt;
  $WHERE/bin/set_fingerprint_perms&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Support more distributions&lt;br /&gt;
* Minimize changes to {{path|/etc/pam.d/system-auth}} by creating a separate file (e.g., {{path|/etc/pam.d/bioapi-auth}}) and &amp;lt;tt&amp;gt;@include&amp;lt;/tt&amp;gt;-ing it.&lt;br /&gt;
* Do something about {{path|/etc/pam.d/sshd}} - it invokes {{path|/etc/pam.d/system-auth}} by stacking, so remote SSH logins now invoke the fingerprint reader... See related discussion in [[How_to_enable_the_fingerprint_reader]].&lt;br /&gt;
* Install and configure a patched xscreensaver (as explained in [[How_to_enable_the_fingerprint_reader]]).&lt;br /&gt;
* Add &amp;quot;&amp;lt;tt&amp;gt;OnResume 10 /opt/bioapi/bin/set_fingerprint_perms&amp;lt;/tt&amp;gt;&amp;quot; to [[Software Suspend 2|suspend2]]'s {{path|/etc/hibernate/hibernate.conf}}?&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Dclatot</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Script_for_enabling_the_fingerprint_reader_with_BioAPI&amp;diff=20300</id>
		<title>Script for enabling the fingerprint reader with BioAPI</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Script_for_enabling_the_fingerprint_reader_with_BioAPI&amp;diff=20300"/>
		<updated>2006-02-22T18:17:50Z</updated>

		<summary type="html">&lt;p&gt;Dclatot: /* The script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using the [[Integrated Fingerprint Reader|integrated fingerprint reader]] under Linux is currently a fairly complicated [[How to enable the fingerprint reader|process]]. The following script automates the installation of the fingerprint software, for some Linux distributions. It covers most components (bioapi framework, driver, pam_bioapi, PAM setup, USB device permissions pamtester and enrolling), and handles all the downloading, patching and installation.&lt;br /&gt;
&lt;br /&gt;
Usage: just copy into a file and run as root.&lt;br /&gt;
&lt;br /&gt;
After installation, all PAM-enabled system functions will use the fingerprint reader (and if it fails, default to the usual password entry). This includes:&lt;br /&gt;
* KDE's KDM login (enter an empty password, then swipe finger)&lt;br /&gt;
* KDE's screensaver (enter an empty password, then swipe finger)&lt;br /&gt;
* Gnome's GDM login&lt;br /&gt;
* &amp;lt;tt&amp;gt;su&amp;lt;/tt&amp;gt; &lt;br /&gt;
* &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Everything is intalled into {{path|/opt/bioapi}}, so it doesn't pollute your filesystem. The only files affected outside {{path|/opt/bioapi}} are the ldconfig configuration, PAM configuration, {{path|/etc/rc.local}} and a few symlinks in {{path|/lib/security}}.&lt;br /&gt;
&lt;br /&gt;
For details, manual installation and hints for other distributions, see [[How to enable the fingerprint reader]].&lt;br /&gt;
&lt;br /&gt;
===Distributions supported by this script===&lt;br /&gt;
* {{Fedora}} 4&lt;br /&gt;
&lt;br /&gt;
If you add support for additional distributions, please update this script (using conditionals where necessary) instead of branching it.&lt;br /&gt;
&lt;br /&gt;
==The script==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Install UPEK fingerprint reader driver and associated software on Linux systems.&lt;br /&gt;
# Source: http://thinkwiki.org/wiki/Script_for_enabling_the_fingerprint_reader&lt;br /&gt;
&lt;br /&gt;
set -e -E -x -u   # verbose, abort if anything fails&lt;br /&gt;
&lt;br /&gt;
WHERE=/opt/bioapi&lt;br /&gt;
PASSWD_ENROLLS=0   # should &amp;quot;passwd&amp;quot; do fingerprint enrollment (always)?&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install bioapi:&lt;br /&gt;
&lt;br /&gt;
mkdir -p $WHERE&lt;br /&gt;
wget -N http://www.qrivy.net/~michael/blua/bioapi/bioapi-latest.tar.bz2&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
932425e847449e9612c6894dcbaf44630aecfc13  bioapi-latest.tar.bz2&lt;br /&gt;
EOF&lt;br /&gt;
tar xjf bioapi-latest.tar.bz2&lt;br /&gt;
pushd bioapi-1.2.2&lt;br /&gt;
./configure --with-Qt-dir=no --prefix=$WHERE&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
install -m644 include/bioapi_util.h $WHERE/include/bioapi_util.h&lt;br /&gt;
install -m644 include/installdefs.h $WHERE/include/installdefs.h&lt;br /&gt;
install -m644 imports/cdsa/v2_0/inc/cssmtype.h $WHERE/include/cssmtype.h&lt;br /&gt;
chmod o-w $WHERE/var/bioapi&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Tell ldconfig about bioapi libraries:&lt;br /&gt;
&lt;br /&gt;
[ -d /etc/ld.so.conf.d ] || { echo &amp;quot;Unsupported distribution: no /etc/ld.so.conf.d directory.&amp;quot;; exit 1; }&lt;br /&gt;
echo $WHERE/lib &amp;gt; /etc/ld.so.conf.d/bioapi.conf&lt;br /&gt;
ldconfig&lt;br /&gt;
ldconfig -p | grep -q bioapi || { echo &amp;quot;ldconfig doesn't see bioapi&amp;quot;; exit 1; }&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install UPEK driver:&lt;br /&gt;
&lt;br /&gt;
wget -N http://www.upek.com/support/download/TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
c73466b5c3b26415b300d5c5ffb76deaefadeb32  TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
EOF&lt;br /&gt;
mkdir -p driver&lt;br /&gt;
pushd driver&lt;br /&gt;
unzip ../TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
PATH=&amp;quot;$PATH:$WHERE/bin&amp;quot;&lt;br /&gt;
sh install.sh $WHERE/lib/&lt;br /&gt;
cd NonGUI_Sample&lt;br /&gt;
perl -i -pe 'print &amp;quot;#include &amp;lt;stdlib.h&amp;gt;\n//DISABLED: &amp;quot; if m!^#include &amp;quot;port/bioapi_port.h&amp;quot;$!'  main.c&lt;br /&gt;
gcc -o Sample main.c -I$WHERE/include -L$WHERE/lib -lbioapi100 -DUNIX -DLITTLE_ENDIAN&lt;br /&gt;
install Sample -m755 $WHERE/bin/upek-NonGUI_Sample&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
SERIAL=`$WHERE/bin/BioAPITest | sed -ne &amp;quot;/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install (patched) pam_bioapi:&lt;br /&gt;
&lt;br /&gt;
wget -N http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2 &lt;br /&gt;
wget -N http://badcode.de/downloads/fingerprint.patch &lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
a0bdf3436e55f7dc8b4795243f08a4c9b399dec8  pam_bioapi-latest.tar.bz2&lt;br /&gt;
619254a5bcd3acb8bf1d72b15ea69bfe00f0f064  fingerprint.patch&lt;br /&gt;
EOF&lt;br /&gt;
tar xjvf pam_bioapi-latest.tar.bz2 &lt;br /&gt;
pushd pam_bioapi-0.2.1 &lt;br /&gt;
patch -p0 &amp;lt; ../fingerprint.patch &lt;br /&gt;
CPPFLAGS=&amp;quot;-I$WHERE/include&amp;quot; LDFLAGS=&amp;quot;-L$WHERE/lib&amp;quot; ./configure --prefix=$WHERE&lt;br /&gt;
make &lt;br /&gt;
make install &lt;br /&gt;
ln -vfs $WHERE/lib/security/pam_bioapi.so* /lib/security/&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install pamtester:&lt;br /&gt;
&lt;br /&gt;
wget http://mesh.dl.sourceforge.net/sourceforge/pamtester/pamtester-0.1.2.tar.gz&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
33bcc610d7f208b50a0a23c144bdbd1e2cae4ac6  pamtester-0.1.2.tar.gz&lt;br /&gt;
EOF&lt;br /&gt;
tar xzvf pamtester-0.1.2.tar.gz&lt;br /&gt;
pushd pamtester-0.1.2&lt;br /&gt;
./configure --prefix=$WHERE&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Configure pam to use pam_bioapi:&lt;br /&gt;
&lt;br /&gt;
grep -q 'Fedora Core release 4' /etc/redhat-release || { echo \&lt;br /&gt;
  &amp;quot;I don't know how to configure PAM on this distribution.&lt;br /&gt;
   See: http://thinkwiki.org/wiki/How_to_enable_the_fingerprint_reader#Configuring_pam&amp;quot;;&lt;br /&gt;
   exit 1; }&lt;br /&gt;
&lt;br /&gt;
PAMFILE=/etc/pam.d/system-auth&lt;br /&gt;
if ! grep -q 'pam_bioapi\.so' $PAMFILE; then&lt;br /&gt;
  perl -i -pe '&lt;br /&gt;
    if (!$a &amp;amp;&amp;amp; m/^auth.*pam_unix\.so/) {$a=1; print &lt;br /&gt;
      &amp;quot;auth        sufficient    pam_bioapi.so '$SERIAL' /etc/bioapi/pam/\n&amp;quot;}&lt;br /&gt;
    ' $PAMFILE&lt;br /&gt;
  if [ $PASSWD_ENROLLS == 1 ]; then&lt;br /&gt;
    perl -i -pe '&lt;br /&gt;
      if (!$p &amp;amp;&amp;amp; m/^password/) {$p=1; print&lt;br /&gt;
        &amp;quot;password    required      pam_bioapi.so '$SERIAL' /etc/bioapi/pam/\n&amp;quot;}&lt;br /&gt;
      ' $PAMFILE&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# USB permissions (set now and add to startup):&lt;br /&gt;
&lt;br /&gt;
RC_FILE=/etc/rc.local&lt;br /&gt;
SET_PERMS=$WHERE/bin/set_fingerprint_perms&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; $SET_PERMS &amp;lt;&amp;lt;'EOF'&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Make fingerprint reader USB device world-writable:&lt;br /&gt;
chmod -R a+X /proc/bus/usb&lt;br /&gt;
chmod 666 /proc/bus/usb/`/sbin/lsusb | sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`&lt;br /&gt;
EOF&lt;br /&gt;
chmod 755 $SET_PERMS&lt;br /&gt;
&lt;br /&gt;
$SET_PERMS&lt;br /&gt;
&lt;br /&gt;
[ -e $RC_FILE ] || { echo &amp;quot;No $RC_FILE, can't handle this distribution.&amp;quot;; exit 1; }&lt;br /&gt;
if ! grep -q 0483:2016 $SET_PERMS; then&lt;br /&gt;
  echo $SET_PERMS &amp;gt;&amp;gt; $RC_FILE&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Enroll:&lt;br /&gt;
&lt;br /&gt;
mkdir -p /etc/bioapi/pam/$SERIAL&lt;br /&gt;
pushd /etc/bioapi/pam/$SERIAL&lt;br /&gt;
read -p &amp;quot;Now enroll all relevant Unix accounts (press Enter to start).&amp;quot;&lt;br /&gt;
$WHERE/bin/upek-NonGUI_Sample&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Done:&lt;br /&gt;
&lt;br /&gt;
set +x&lt;br /&gt;
cat&amp;lt;&amp;lt;EOF&lt;br /&gt;
&lt;br /&gt;
Success.&lt;br /&gt;
* To test the fingerprint-enabled PAM login, run:&lt;br /&gt;
  $WHERE/bin/pamtester -v login USERNAME authenticate&lt;br /&gt;
* Add the following command to your resume-from-suspend script:&lt;br /&gt;
  $WHERE/bin/set_fingerprint_perms&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Support more distributions&lt;br /&gt;
* Minimize changes to {{path|/etc/pam.d/system-auth}} by creating a separate file (e.g., {{path|/etc/pam.d/bioapi-auth}}) and &amp;lt;tt&amp;gt;@include&amp;lt;/tt&amp;gt;-ing it.&lt;br /&gt;
* Do something about {{path|/etc/pam.d/sshd}} - it invokes {{path|/etc/pam.d/system-auth}} by stacking, so remote SSH logins now invoke the fingerprint reader... See related discussion in [[How_to_enable_the_fingerprint_reader]].&lt;br /&gt;
* Install and configure a patched xscreensaver (as explained in [[How_to_enable_the_fingerprint_reader]]).&lt;br /&gt;
* Add &amp;quot;&amp;lt;tt&amp;gt;OnResume 10 /opt/bioapi/bin/set_fingerprint_perms&amp;lt;/tt&amp;gt;&amp;quot; to [[Software Suspend 2|suspend2]]'s {{path|/etc/hibernate/hibernate.conf}}?&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Dclatot</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Script_for_enabling_the_fingerprint_reader_with_BioAPI&amp;diff=20296</id>
		<title>Script for enabling the fingerprint reader with BioAPI</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Script_for_enabling_the_fingerprint_reader_with_BioAPI&amp;diff=20296"/>
		<updated>2006-02-22T15:14:51Z</updated>

		<summary type="html">&lt;p&gt;Dclatot: /* The script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using the [[Integrated Fingerprint Reader|integrated fingerprint reader]] under Linux is currently a fairly complicated [[How to enable the fingerprint reader|process]]. The following script automates the installation of the fingerprint software, for some Linux distributions. It covers most components (bioapi framework, driver, pam_bioapi, PAM setup, USB device permissions pamtester and enrolling), and handles all the downloading, patching and installation.&lt;br /&gt;
&lt;br /&gt;
Usage: just copy into a file and run as root.&lt;br /&gt;
&lt;br /&gt;
After installation, all PAM-enabled system functions will use the fingerprint reader (and if it fails, default to the usual password entry). This includes:&lt;br /&gt;
* KDE's KDM login (enter an empty password, then swipe finger)&lt;br /&gt;
* KDE's screensaver (enter an empty password, then swipe finger)&lt;br /&gt;
* Gnome's GDM login&lt;br /&gt;
* &amp;lt;tt&amp;gt;su&amp;lt;/tt&amp;gt; &lt;br /&gt;
* &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Everything is intalled into {{path|/opt/bioapi}}, so it doesn't pollute your filesystem. The only files affected outside {{path|/opt/bioapi}} are the ldconfig configuration, PAM configuration, {{path|/etc/rc.local}} and a few symlinks in {{path|/lib/security}}.&lt;br /&gt;
&lt;br /&gt;
For details, manual installation and hints for other distributions, see [[How to enable the fingerprint reader]].&lt;br /&gt;
&lt;br /&gt;
===Distributions supported by this script===&lt;br /&gt;
* {{Fedora}} 4&lt;br /&gt;
&lt;br /&gt;
If you add support for additional distributions, please update this script (using conditionals where necessary) instead of branching it.&lt;br /&gt;
&lt;br /&gt;
==The script==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Install UPEK fingerprint reader driver and associated software on Linux systems.&lt;br /&gt;
# Source: http://thinkwiki.org/wiki/Script_for_enabling_the_fingerprint_reader&lt;br /&gt;
&lt;br /&gt;
set -e -E -x -u   # verbose, abort if anything fails&lt;br /&gt;
&lt;br /&gt;
WHERE=/opt/bioapi&lt;br /&gt;
PASSWD_ENROLLS=0   # should &amp;quot;passwd&amp;quot; do fingerprint enrollment (always)?&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install bioapi:&lt;br /&gt;
&lt;br /&gt;
mkdir -p $WHERE&lt;br /&gt;
wget -N http://www.qrivy.net/~michael/blua/bioapi/bioapi-latest.tar.bz2&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
932425e847449e9612c6894dcbaf44630aecfc13  bioapi-latest.tar.bz2&lt;br /&gt;
EOF&lt;br /&gt;
tar xjf bioapi-latest.tar.bz2&lt;br /&gt;
pushd bioapi-1.2.2&lt;br /&gt;
./configure --with-Qt-dir=no --prefix=$WHERE&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
install -m644 include/bioapi_util.h $WHERE/include/bioapi_util.h&lt;br /&gt;
install -m644 include/installdefs.h $WHERE/include/installdefs.h&lt;br /&gt;
install -m644 imports/cdsa/v2_0/inc/cssmtype.h $WHERE/include/cssmtype.h&lt;br /&gt;
chmod o-w $WHERE/var/bioapi&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Tell ldconfig about bioapi libraries:&lt;br /&gt;
&lt;br /&gt;
[ -d /etc/ld.so.conf.d ] || { echo &amp;quot;Unsupported distribution: no /etc/ld.so.conf.d directory.&amp;quot;; exit 1; }&lt;br /&gt;
echo $WHERE/lib &amp;gt; /etc/ld.so.conf.d/bioapi.conf&lt;br /&gt;
ldconfig&lt;br /&gt;
ldconfig -p | grep -q bioapi || { echo &amp;quot;ldconfig doesn't see bioapi&amp;quot;; exit 1; }&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install UPEK driver:&lt;br /&gt;
&lt;br /&gt;
wget -N http://www.upek.com/support/download/TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
c73466b5c3b26415b300d5c5ffb76deaefadeb32  TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
EOF&lt;br /&gt;
mkdir -p driver&lt;br /&gt;
pushd driver&lt;br /&gt;
unzip ../TFMESS_BSP_LIN_1.0.zip&lt;br /&gt;
PATH=&amp;quot;$PATH:$WHERE/bin&amp;quot; &lt;br /&gt;
sh install.sh $WHERE/lib/&lt;br /&gt;
cd NonGUI_Sample&lt;br /&gt;
perl -i -pe 'print &amp;quot;#include &amp;lt;stdlib.h&amp;gt;\n//DISABLED: &amp;quot; if m!^#include &amp;quot;port/bioapi_port.h&amp;quot;$!'  main.c&lt;br /&gt;
gcc -o Sample main.c -I$WHERE/include -L$WHERE/lib -lbioapi100 -DUNIX -DLITTLE_ENDIAN&lt;br /&gt;
install Sample -m755 $WHERE/bin/upek-NonGUI_Sample&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
SERIAL=`$WHERE/bin/BioAPITest | sed -ne &amp;quot;/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install (patched) pam_bioapi:&lt;br /&gt;
&lt;br /&gt;
wget -N http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2 &lt;br /&gt;
wget -N http://badcode.de/downloads/fingerprint.patch &lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
a0bdf3436e55f7dc8b4795243f08a4c9b399dec8  pam_bioapi-latest.tar.bz2&lt;br /&gt;
619254a5bcd3acb8bf1d72b15ea69bfe00f0f064  fingerprint.patch&lt;br /&gt;
EOF&lt;br /&gt;
tar xjvf pam_bioapi-latest.tar.bz2 &lt;br /&gt;
pushd pam_bioapi-0.2.1 &lt;br /&gt;
patch -p0 &amp;lt; ../fingerprint.patch &lt;br /&gt;
CPPFLAGS=&amp;quot;-I$WHERE/include&amp;quot; LDFLAGS=&amp;quot;-L$WHERE/lib&amp;quot; ./configure --prefix=$WHERE&lt;br /&gt;
make &lt;br /&gt;
make install &lt;br /&gt;
ln -vfs $WHERE/lib/security/pam_bioapi.so* /lib/security/&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Install pamtester:&lt;br /&gt;
&lt;br /&gt;
wget http://mesh.dl.sourceforge.net/sourceforge/pamtester/pamtester-0.1.2.tar.gz&lt;br /&gt;
sha1sum --check &amp;lt;&amp;lt;EOF&lt;br /&gt;
33bcc610d7f208b50a0a23c144bdbd1e2cae4ac6  pamtester-0.1.2.tar.gz&lt;br /&gt;
EOF&lt;br /&gt;
tar xzvf pamtester-0.1.2.tar.gz&lt;br /&gt;
pushd pamtester-0.1.2&lt;br /&gt;
./configure --prefix=$WHERE&lt;br /&gt;
make&lt;br /&gt;
make install&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Configure pam to use pam_bioapi:&lt;br /&gt;
&lt;br /&gt;
grep -q 'Fedora Core release 4' /etc/redhat-release || { echo \&lt;br /&gt;
  &amp;quot;I don't know how to configure PAM on this distribution.&lt;br /&gt;
   See: http://thinkwiki.org/wiki/How_to_enable_the_fingerprint_reader#Configuring_pam&amp;quot;;&lt;br /&gt;
   exit 1; }&lt;br /&gt;
&lt;br /&gt;
PAMFILE=/etc/pam.d/system-auth&lt;br /&gt;
if ! grep -q 'pam_bioapi\.so' $PAMFILE; then&lt;br /&gt;
  perl -i -pe '&lt;br /&gt;
    if (!$a &amp;amp;&amp;amp; m/^auth.*pam_unix\.so/) {$a=1; print &lt;br /&gt;
      &amp;quot;auth        sufficient    pam_bioapi.so '$SERIAL' /etc/bioapi/pam/\n&amp;quot;}&lt;br /&gt;
    ' $PAMFILE&lt;br /&gt;
  if [ $PASSWD_ENROLLS == 1 ]; then&lt;br /&gt;
    perl -i -pe '&lt;br /&gt;
      if (!$p &amp;amp;&amp;amp; m/^password/) {$p=1; print&lt;br /&gt;
        &amp;quot;password    required      pam_bioapi.so '$SERIAL' /etc/bioapi/pam/\n&amp;quot;}&lt;br /&gt;
      ' $PAMFILE&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# USB permissions (set now and add to startup):&lt;br /&gt;
&lt;br /&gt;
RC_FILE=/etc/rc.local&lt;br /&gt;
SET_PERMS=$WHERE/bin/set_fingerprint_perms&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; $SET_PERMS &amp;lt;&amp;lt;'EOF'&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Make fingerprint reader USB device world-writable:&lt;br /&gt;
chmod -R a+X /proc/bus/usb&lt;br /&gt;
chmod 666 /proc/bus/usb/`/sbin/lsusb | sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`&lt;br /&gt;
EOF&lt;br /&gt;
chmod 755 $SET_PERMS&lt;br /&gt;
&lt;br /&gt;
$SET_PERMS&lt;br /&gt;
&lt;br /&gt;
[ -e $RC_FILE ] || { echo &amp;quot;No $RC_FILE, can't handle this distribution.&amp;quot;; exit 1; }&lt;br /&gt;
if ! grep -q 0483:2016 $SET_PERMS; then&lt;br /&gt;
  echo $SET_PERMS &amp;gt;&amp;gt; $RC_FILE&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Enroll:&lt;br /&gt;
&lt;br /&gt;
mkdir -p /etc/bioapi/pam/$SERIAL&lt;br /&gt;
pushd /etc/bioapi/pam/$SERIAL&lt;br /&gt;
read -p &amp;quot;Now enroll all relevant Unix accounts (press Enter to start).&amp;quot;&lt;br /&gt;
$WHERE/bin/upek-NonGUI_Sample&lt;br /&gt;
popd&lt;br /&gt;
&lt;br /&gt;
########################################&lt;br /&gt;
# Done:&lt;br /&gt;
&lt;br /&gt;
set +x&lt;br /&gt;
cat&amp;lt;&amp;lt;EOF&lt;br /&gt;
&lt;br /&gt;
Success.&lt;br /&gt;
* To test the fingerprint-enabled PAM login, run:&lt;br /&gt;
  $WHERE/bin/pamtester -v login USERNAME authenticate&lt;br /&gt;
* Add the following command to your resume-from-suspend script:&lt;br /&gt;
  $WHERE/bin/set_fingerprint_perms&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Ideas for improvement==&lt;br /&gt;
* Support more distributions&lt;br /&gt;
* Minimize changes to {{path|/etc/pam.d/system-auth}} by creating a separate file (e.g., {{path|/etc/pam.d/bioapi-auth}}) and &amp;lt;tt&amp;gt;@include&amp;lt;/tt&amp;gt;-ing it.&lt;br /&gt;
* Do something about {{path|/etc/pam.d/sshd}} - it invokes {{path|/etc/pam.d/system-auth}} by stacking, so remote SSH logins now invoke the fingerprint reader... See related discussion in [[How_to_enable_the_fingerprint_reader]].&lt;br /&gt;
* Install and configure a patched xscreensaver (as explained in [[How_to_enable_the_fingerprint_reader]]).&lt;br /&gt;
* Add &amp;quot;&amp;lt;tt&amp;gt;OnResume 10 /opt/bioapi/bin/set_fingerprint_perms&amp;lt;/tt&amp;gt;&amp;quot; to [[Software Suspend 2|suspend2]]'s {{path|/etc/hibernate/hibernate.conf}}?&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>Dclatot</name></author>
		
	</entry>
</feed>