I am trying to make a little script run by pam sshdsession optional pam_exec.so /foo/myscriptthat would want to check the ip of the connecting user and if already in my database, do nothing, if not, write it in my database and send me an email. My problem is that ifa) I run this script as the user, I can read $SSH_CLIENT and find out the IP, but not write to the database (as it should be, since I don't want user messing with it)b) if I run it as root I'm not sure how to find out about the current connections IP.Is there a workaround? Thanks.
pam sshd: run as root but get user ip
ssh;pam