Hi jamfnation, ;-)
I have searched the forum to get closer to my problem, but I can not find a solution yet.
In some cases I need the Current/Active user in a variable when I run as root and "Fast User Switching" is "Enabled" and more than one user is logged in. How do I get the real Active one (Active Screen running on the Mac-Display)!?
One example: When I log in to an AD-user-session, beginning in the login window via Casper Remote, the AD user proceeds to login and I will get the prompt to ask the user to login or login as casperscreensharing (everybody knows). In that case, when nobody is in front of the book (dev cases), I choose: login as casperscreensharing. Logged in as casperscreensharing, I switch to the active AD-Account, still logged in while I logged in with casperscreensharing in the background...
There are a some of the commands I found and used a lot of times that are published in the community to get the active user, but the ones I found can not handle my problem yet:
- id -un //user context
- ls -la /dev/console etc... //user context
- finger ... //user context
- w -ih ... //user context
- last -x ... //user context
- users ... //user context
- /Library/Preferences/com.apple.loginwindow.plist ... //user context
- are there more!? ;-) ...
Does anyone know how to get the "current/active" user when more then one is logged in and we run as "root"!?
Is there an easy trick/tool or maybe someone has written a comparison of the above tools to get the current/active user!?
//Just to be safe: Bash/Python
Thanks a lot for your help.
Cheers,
Alex
