Home > Tech > sudo auth with Touch ID and tmux

sudo auth with Touch ID and tmux

If you want iTerm to allow sudo authentication to work with Touch ID, follow these steps.

  1. First, with iTerm you must Turn off Prefs > Advanced > Allow sessions to survive logging out and back in
  2. Next, run: brew install pam-reattach 
  3. Run the following command to find the path to pam_reattach.so:
    • find -L /usr/ /opt/ -name "pam_reattach.so" 2>/dev/null | grep -i "homebrew/lib/pam/"
  4. Then you need to sudo nano /etc/pam.d/sudo  and add the 2 highlighted lines below. Note the homebrew install pam_reattach.so path you retrieved in the previous step. You’ll need the full path because it is not in PATH by default
    • Save the file and exit.
  5. Kill all tmux sessions and restart iTerm2.
  6. Now when you run sudo ls you should be able to use TouchID, instead of typing your password, to authenticate

Finally, fix up iTerm2 so you can use option + arrow  to jump between words in the terminal:

https://superuser.com/questions/427163/altarrow-moving-between-words-in-zsh-and-iterm2

  • In iTerm2, go to Preferences > Profile > Keys
  • Under the list of Key Mappings there is a box to add/remove or load Presets (combo box)
  • Select the Natural Text Editing option in the Presets drop down.
Categories: Tech
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment