4 ms·
Here's a single line you can run that'll add the needed line to the file in the correct place for you: sudo perl -pi -e 's/(pam_smartcard.so)/$1\nauth suff
by jph00 4y ago
Here's a single line you can run that'll add the needed line to the file in the correct place for you:
sudo perl -pi -e 's/(pam_smartcard.so)/$1\nauth sufficient pam_tid.so/' /etc/pam.d/sudo
- ayewo 4y agoThanks for sharing. While tweaking the formatting, I accidentally introduced a typo which led to me spending a few minutes hunting for a fix for "sudo: unable to initialize PAM: No such process" without having to reboot :( Anyway, here's the version of your one-liner I used to preserve the spacing used in the rest of the file: sudo perl -pi -e 's/(pam_smartcard.so)/$1\nauth sufficient pam_tid.so/' /etc/pam.d/sudo
- gnubison 4y agoOr something like printf '%s\n' '/pam_smartcard\.so/a' 'auth sufficient pam_tid.so' . wq | sudo ex -s /etc/pam.d/sudo