Using TouchID for “sudo” in terminal

More and more Macs have a fingerprint scanner on the top right of the keyboard. This is on the MacBook Air, MacBook Pro and on the recent Magic Keyboards. With the TouchID you can identify yourself on your Mac. An advanced terminal user often needs to authenticate as sudo to grant themselves privileges to open files or execute commands that require higher privileges. It would be useful if this could be done with the TouchID. Because you obviously have a complex password, and after a few times it can be annoying to enter again.

With a small adjustment you can use the TouchID.

Go to your terminal by command + space and type terminal in the search field.
in the terminal type the following followed by your password

sudo nano /etc/pam.d/sudo

Add the line below to the configfile

auth  sufficient

The file will then look like this:


Close the editor with the keys:

"control" - "x" - "y" en "enter"

Now you will get a popup from TouchID in the future if you need sudo permissions.

sudo nano /etc/hosts

Tags: , , ,
Previous Post

Start soon “Your corporate network on Linux” Intro