Know the username of a user trying to logged
Question
I've a debian system, when a user try to login, a pam module exec a bash script as root. I need this script to know who is trying to login.
But the user isn't already connected so basic command as users/w/who ... doesn't work here.
So is there a possibility to retrieve the username of a user trying to get logged ?
Thank you. Cyrbil
Solution
You can also use /etc/profile
or /etc/bashrc
to grab the user logging in, I typically have a small script that gets executed via /etc/bashrc
that gives me details about the user (who it is, connecting from what IP address etc).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow