I want to echo some text from a pam_exec
script after a successful SSH login (pubkey) but before the script itself exits (2FA purposes).
Whatever the script prints during its execution is displayed when the script terminates.
Example:
#!/bin/bash
echo "YAY!"
sleep 2
exit 0
YAY!
is printed only after 2 seconds followed by motd and command prompt. Obviously I have already added "stdout
" in the PAM entry:
account required pam_exec.so stdout /etc/test/test.sh
This guy (https://stackoverflow.com/a/43715952/12662891) had a similar problem but I can't find out how he solved his problem.