|
#1
| |||
| |||
| loginhook situation: Mac client authenticating using LDAP. Clients have a local Homedirectory. I want: I want to log user statistics, when and where users log in. I created a loginhook: # user is not admin -> continue set localadmin = admin if ( $1 != $localadmin ) then # ------------------------------------------ # Logging information # ------------------------------------------ if ( ! -d /private/var/tmp/stats ) then mkdir /private/var/tmp/stats endif mount -t afp afp://user ass@server/volume /private/var/tmp/statsset LOGINNAME = `who | awk '{ print $1 }'` set MAC = `/sbin/ifconfig en0 | /usr/bin/awk '/ether/ { gsub(":", ""); print $2 }'` # ------------------------------------------ set RIGHTNOW = `date` echo "login: $LOGINNAME $RIGHTNOW $MAC" >> /private/var/tmp/stats/stats/login.txt umount -f /private/var/tmp/stats endif ### Always exit with 0 status exit 0 logging is OK but the part which is checking who logged in does not work; the only thing found is the user who executed the script, which is root. So I need to know how to find the UID of the person who logged in. can you help? |
|
#2
| ||||
| ||||
| Can you echo "whoami"?... or will that also show "root"?
__________________ TommyWillB Intel iMac "early 2006" core duo TommyWillB.com hosted on Mac OS X 10.5.x / Apache 2.2.x / PHP 5.x |
|
#3
| |||
| |||
| Quote:
|
![]() |
| Thread Tools | |
|
|