4

Having recently got a device that has a fingerprint reader built in, I set to enabling fingerprint authentication. I have this is sudo now, and this is useful in my terminal.

The issue I'm running into is that when I use emacs tramp to elevate privileges, it calls sudo and waits for the fingerprint to be read (this does work, it just doesn't prompt anything). Where in a terminal I can Ctrl+C to go to password auth if I feel like it (all I did to /etc/pam.d/sudo is add auth sufficient pam_fprintd.so to the top), I can't here as with tramp that is nicely abstracted. I would prefer to just disable fingerprint auth for tramp, but keep it in normal sudo. Is this possible?

I've looked things up and the only thing that spoke to me as a possible solution is using a different privilege escalator, such as su or run0, but those require the root password, which I have disabled. I could theoretically use doas, but it feels weird installing a whole separate stack that I'll barely use...

Any help is appreciated

6
  • Maybe @MichaelAlbinus can help...
    – NickD
    Commented Oct 9 at 1:58
  • Related: askubuntu.com/questions/1015416/… - there is mention of a timeout that is settable but with a minimum of 10 seconds. If you wait 10 seconds, does it then let you type in the password? This is just data gathering, not a solution or even a work-around... Later: except I cannot find the file they mention, so this is probably obsolete.
    – NickD
    Commented Oct 9 at 2:15
  • Does sudo show a prompt requesting the fingerprint? If yes, we could add this prompt to Tramp and make it visible. Note, that we have done already something similar with yubikey authentication. Commented Oct 9 at 10:45
  • Sudo does show a prompt: Place your finger on the fingerprint reader, would it be possible to add that in to tramp? This prompt also times out after 30 seconds with the message: Verification timed out
    – neri
    Commented Oct 10 at 12:21
  • @MichaelAlbinus is there a way to implement this? (I do realise this is by no means a priority, I'd just like to know if it's being worked on/planned to be implemented) If there's any way I can help, please let me know (bearing in mind I have very little coding experience aside from small scripts and config files).
    – neri
    Commented Nov 22 at 20:39

2 Answers 2

0

Fingerprint readers are supported in Tramp, starting with version 2.7.1.5.

2

Sudo doesn't give the calling user much control over authentication methods. But you can get some control through the PAM stack. One way to solve your problem would be to have sudo detect when it's being called from Tramp, and skip fingerprint authentication in that case.

Here's a rough idea of how you can do this (I can't test this in the short term):

  1. Create a program /usr/local/bin/sudo_should_skip_fingerprints that exits with status 1 to use fingerprints and 0 to skip fingerprints.
  2. Add the line below to your PAM configuration.
auth   [success=1 default=ignore] pam_exec.so quiet /usr/local/bin/sudo_should_skip_fingerprints
auth   sufficient   pam_fprintd.so
…

For sudo_should_skip_fingerprints, check if the environment indicates a call from Tramp. Something like this:

#!/bin/sh
case ",$INSIDE_EMACS," in
  *,tramp:*) exit 1;;
  *) exit 0;;
esac

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.