I made a login script in Perl which has to run on Mac OS X clients and record the Logged in Directory Service user name.
I tried using getlogin() , getpwuid($<) respectively.
Now the problem is that since the login script runs as root on the system when the client logs in, getpwuid($<) always gives me the username as root. When using the getlogin() function, i do get the user name but for the user who logged in previously on the system.
I am using an open directory environment consisting of a Mac OS server.
Any ideas on how to solve this issue?
Are you talking about a loginhook script? If so, it’ll get passed the username as an argument, so
$ARGV[0]should be what you need.