MacOS Catalina let us do some higher privilege actions on our Mac by authorising through a press on our Apple Watch button.

Would it be possible to use that feature to authorise a sudo command in the Terminal?

  • 1
    Depends what do you mean by "possible". You could change the $SUDO_ASKPASS environment variable to define a helper program (that you wrote) to do the validation. This program would then pass the password to tgetpass.c. See this SO question. Not sure how practical/difficult it would be though. – lx07 Nov 12 '19 at 15:58
  • 1
    I was thinking something similar to what you can do with touch ID, where it is possible to activate a PAM module to authorise sudo with touch ID on the CLI. – Tonin Nov 12 '19 at 17:51
  • 1
    That would be neat! A quick look here doesn't show such a module yet unfortunately. – lx07 Nov 12 '19 at 19:27
  • @Gummibando I second Tonin in this: Transform the comment into an answer, I'll be happy to upvote it (tried it and it worked great) – nd. Nov 22 '19 at 9:04
  • @Tonin Converted. Cheers. – Gummibando Nov 23 '19 at 7:49

There is a PAM module for this on GitHub:


(This is forked from a TouchID PAM module, btw.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .