🌐 이 글의 한국어 원문이 있습니다.한국어 원문 보기 →

· 7 min read

Logging In with ‘Face ID’ on Ubuntu Linux

While unlocking my iPhone with face recognition, a thought suddenly struck me: couldn't I log in to ‘Ubuntu’ with face recognition, too?

I looked it up, and there is a way. It's a package called https://github.com/boltgolt/howdy.

You can experience on Ubuntu the same login and password entry via ‘face authentication’ that you get on today's phones. Installation is simple, too. All you need is a webcam for face authentication.

First, add the repository, update, and install howdy.

sudo add-apt-repository ppa:boltgolt/howdy
sudo apt update
sudo apt install howdy

During installation, it asks you to choose one of [f/b/s]. It's asking whether you want Fast authentication, strict (Secured) authentication, or a balance of the two (Balanced). (I played it safe and chose b.)

Installation is simple, but it takes up a fair amount of space (over 500 MB). It installs and compiles various packages for the authentication process.

Once it's installed, you need to specify in the config file exactly which camera device howdy should use.

To find the camera device, you need the following package.

sudo apt install v4l-utils

Once it's installed, let's list the devices available to the operating system.

$ v4l2-ctl --list-devices

Microsoft® LifeCam HD-3000: Mi (usb-0000:02:00.0-1.2):
	/dev/video0
	/dev/video1
	/dev/media0

I only have one webcam installed. But when I listed the devices, three media devices showed up within the webcam. Not all of them are ‘camera’ devices, though. You need to find the camera device among them.

$ v4l2-ctl --device=/dev/video0 --all
...
Crop Capability Video Capture:
	Bounds      : Left 0, Top 0, Width 640, Height 480
	Default     : Left 0, Top 0, Width 640, Height 480
	Pixel Aspect: 1/1

When you query them, one of the devices includes ‘Capability.’ That's the camera device. In my case, video1 has no capability. media0 shows up in the list, but when I actually query it, it says the device doesn't exist.

Once you've found the right camera device, let's put it in the config file.

$ sudo howdy config
....
[video]
# The certainty of the detected face belonging to the user of the account
# On a scale from 1 to 10, values above 5 are not recommended
# Lower is better
certainty = 2.8

# The number of seconds to search before timing out
timeout = 4

# The path of the device to capture frames from
# Should be set automatically by an installer if your distro has one
#device_path = /dev/v4l/by-path/none
device_path = /dev/video0

When you run the sudo howdy config command, an editor opens in the terminal. Enter the device path you found earlier here.

After saving, let's add a photo. But everything in howdy is done through commands. You can't see how the photo is actually being taken. So before adding a photo, let's check the camera angle first.

sudo howdy test

When you run this command, a GUI window appears, the only (?) one in howdy. When a face is recognized, it outlines the face with a red circle, so use that to set your angle.

Now let's add a photo.

$ sudo howdy add
Adding face model for the user $USER
Enter a label for this new model [Model #3] (max 24 characters): 

You can type a model name or just press Enter. This is the label you'll use later to manage the model, for example to ‘delete’ it.

Please look straight into the camera
Scan complete

Added a new model to $USER

After you press Enter, it asks you to look straight into the camera and quickly captures a photo.

Once the model has been added, it tells you a model was added under your username. You can list the added models with the command below.

sudo howdy list

When I tried authenticating, it sometimes didn't work well depending on the camera's condition (?). So each time it failed, I added another model, and that seems to work well. If it worked yesterday but won't authenticate today, don't overthink it; just add another model for today ;)

Now let's check whether authentication works. Lock the screen with Lock Screen, then try logging in.

If authentication works, the screen will unlock as soon as you ‘click’ to unlock the locked screen.

It also applies when you type commands in the terminal.

sungyo@sungyobuntu:~$ sudo su
Identified face as $USER
root@sungyobuntu:/home/$USER#

So far, we've used howdy to set up ‘Face ID.’ With howdy, you can set up an environment where you can authenticate and get to work right away, without any separate additional authentication device such as a USB key.

Face authentication is a very simple method. But it has a critical ‘security issue (?)’. I won't say what the issue is. To build an ‘authentication environment’ that is both convenient and secure, you need some management, such as 2-factor authentication or narrowing the scope of howdy authentication. This can be done through PAM authentication settings. For details, see the wiki on the howdy GitHub.

References

https://itsfoss.com/face-unlock-ubuntu/itsfoss.com https://github.com/boltgolt/howdy/wiki/Common-issuesgithub.com

Related posts

Home