开发者

Find the name of Directory Service User via Login Script in Perl

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 getlog开发者_如何学Goin() 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.


Can you just use last? (man page) The log-in names and the duration are already in the wtmp file. I don't think you need to log them yourself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜