Skip to main content
Solved

Login script command run as user not working anymore.

  • December 30, 2013
  • 1 reply
  • 0 views

Forum|alt.badge.img+9
  • Valued Contributor
  • 137 replies

Setting the following variable to gather the user logging in and utilizing it via sudo used to work. The command now reports the console user as root. I have no idea when the behavior changed. When I setup the script initially it was working fine. That was Casper ver 9.1. Now at 9.22 it doesn't work. I have no idea if it is related to the release version or not.

consoleuser=ls -l /dev/console | /usr/bin/cut -d " " -f 4
/usr/bin/sudo -u $consoleuser CMDHERE

before this would result in:
/usr/bin/sudo -u johndoe CMDHERE

now it results in:
/usr/bin/sudo -u root CMDHERE

Getting the value for the last logged in user out of com.apple.loginwindow.plist gets the last logged in user, not the current. IE, the script is running before com.apple.loginwindow.plist is updated.

Has anyone else seen this? I've seen people recommend using a launch hook. I'd prefer not.

Best answer by MrP

Apparently I turned the following option off at some point which causes this behavior.

From:mm2270 on https://jamfnation.jamfsoftware.com/discussion.html?id=7649

There's already an option in the JSS for that (globally) Look under:
Settings > Computer Management Framework Settings > Login and Logout Hooks
Check an option called "Perform login actions in background" I believe that will resolve your issue.

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+9
  • Author
  • Valued Contributor
  • 137 replies
  • Answer
  • December 30, 2013

Apparently I turned the following option off at some point which causes this behavior.

From:mm2270 on https://jamfnation.jamfsoftware.com/discussion.html?id=7649

There's already an option in the JSS for that (globally) Look under:
Settings > Computer Management Framework Settings > Login and Logout Hooks
Check an option called "Perform login actions in background" I believe that will resolve your issue.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings