Log in using your webcam on Linux

Using pam-face-authentication, you can login using your face and webcam instead of typing a password. You can also use your face to authenticate when using commands such as su and sudo, and virtually all other applications that ask for your account passowrd, even if you are in text-only mode.

For more information visit their website.

Depending on the quality of your webcam, face recognition technology generally works best in environments with plenty of light and with no variations in light intensity. In other words, it will work better on a desktop in a well-lit room that on a laptop, which will generally be moved about a lot, and have poor webcams anyway. If you use a laptop, you may need to create more than one profile for each room of the house that has a considerable lighting difference, one for outside, etc. (And no, it will not work in poorly lit or dark rooms.)

Now for installation. First, you have to install the face-authentication PAM plugin. The exact procedure varies across distributions, but it is usually in a package called pam-face-authentication. For example, Ubuntu users can install it typing this at the terminal:

  1. $ sudo add-apt-repository ppa:antonio.chiurazzi/ppa
  2. $ sudo apt-get update && sudo apt-get install pam-face-authentication

Arch Linux users can find it in the package pam-face-authentication-svn in the AUR.

Users of other distributions should be able to find a package named pam-face-authentication or similar using their package manager. If not, you can find instructions on how to compile it from source here.

Now you have to train pam-face-auth to recognise you when you login. To open the face trainer, open a terminal and type qt-facetrainer. The face trainer is mostly self-explanatory, so I won’t go into detail here. To create multiple profiles, just repeat the capture process multiple times.

Now all we have to do is configure each service you want face login to work with. All these commands must be run in a terminal with root privileges (type sudo -i or su).

# ls /etc/pam.d/

This will give you a list of services and applications that can be used with face-auth. If you don’t know what each of these are, gdm, kdm, lxdm and lightdm are display managers (the login screen that appears when you start up), su, sudo and polkit-1 handle privilege escalation (the “Please insert your password to perform xyz” prompts that appears when you perform an administrative task), and login is the text mode login prompt. Beginner users should generally start of with the display manager, su, sudo and polkit-1.

Now, you have to open each file you want to configure with the text editor:

# nano /etc/pam.d/xyz

Add the following line to the top of the file:

auth sufficient pam_face_authentication.so enableX

And then save the file (Ctrl+O), and exit (Ctrl+x). Repeat this process for all of the applications that you want to configure.
To disable face-auth, just comment the line out (add a # to the beginning of the line).

Depending on your webcam and distribution, you may also have to add the following line:

/usr/lib/libv4l/v4l1compat.so

To your /etc/ld.so.preload file.

If, when you are loging in with the webcam, you close the face-login window, you will be asked for your password instead.

If you have any problems setting this up, just leave a comment below.

Tags:
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: