Skip to main content
Question

Login Hook not working

  • December 10, 2014
  • 31 replies
  • 25 views

Show first post

31 replies

Forum|alt.badge.img+4
  • Contributor
  • May 19, 2015

@bentoms

No, only one login hook can be used at same time, besides, I'm not using Caspar yet...
I solved my problem by stop using LoginHook, something we probably all should do.

A good replacement is MagerValps LoginScriptPlugin. See here:

https://github.com/MagerValp/LoginScriptPlugin

and

https://developer.apple.com/library/mac/technotes/tn2228/_index.html

Cheers


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • May 20, 2015

@haggan I just presumed that as you were posting here you were using the suite.

AFAIK, Pers tool is extremely experimental. But if it works for you. Then go for it.


Forum|alt.badge.img+7
  • Contributor
  • June 15, 2016

Looks like no one has posted on this thread in a while so I'm going to use the defibrillator to bring it back!

I'm a noob so please forgive me in advance.

I'm also having difficulty with the loginhook. It is enabled on my JSS. My policy is a dock policy to make dock the same for all new users providing them with tiles for apps used by our students. I'm also removing tiles not needed. We are an AD environment and I run a cron every morning at 4AM to delete all users except my local admin account. Thus all users are new every day. We have about 1800 students that could use these lab iMacs so this is the best solution for us that I personally can think of at the moment.

So it appears that loginhooks do not run when a user is first created. If I logout and log back in, my loginhook for the dock runs perfectly. I can run it manually, and it runs perfectly. I can change the policy to run at recurring check-in, and it runs perfectly. I do get very weird results when I set the policy to Network State Change...basically it seems the policy is running on new user login but it removes all dock tiles save Finder and Trash.

I'm trying to figure out a way that my noob self can make this happen. I used to do it with a custom English.lproj file that I placed into /System/Library/User Template/ . This process however doesn't seem to work anymore with 10.11 El Capitan. (Thanks Apple!) So my thoughts are maybe create a script to run my policy and find a way to add it as a login item in the default user template? But I have no idea where or how to do that.

Any suggestions?


Forum|alt.badge.img+23
  • Esteemed Contributor
  • June 15, 2016

Just had a quick scan of the thread. The following springs to mind:

Do you have Casper suite set to deliver login and logout policies? If so, that'll be why as Casper will overwrite your login hook.

My thoughts: Ditch the loginhook! If you need it to run on user login, use a launch agent. Unless you need root, in which case there are ways to work around the launchdaemon running immediately thing.

The other thing to look at is Outset . This is the handiest way I know of running scripts that are locally stored on a machine.


Forum|alt.badge.img+3
  • New Contributor
  • June 15, 2016

I'm sorry If I'm asking something obvious but I don't quite understand your cron job. Do you use AD users or local users?
Concerning the login hook: I think you're right, login hooks don't work for me as well when a user is first logged in.
Maybe have a look at that? El Capitan User Template dock customisation issue


Forum|alt.badge.img+7
  • Contributor
  • June 15, 2016

@HollyShort Thanks for the link I'll read up on that. For now I've just about got a custom English.lproj working. One minor permissions issue but I'll keep hammering away at that. Regarding your question, our iMacs our bound to our AD and users login via their AD credentials. Unfortunately this creates an account locally and we don't want them to be saving or doing anything college students will do (nuff said on that). So we have a script to delete any account that doesn't match our local admin account. The cronjob runs that script everyday at 4AM.

@franton Thanks for the advise. I've gone back to trying to get a skeleton account setup. That worked best for us when at 10.10. I'm running into one problem with it. When I use my "setup" account to create how I want the default profile to look. I tar it, rename the original English.lproj to English.lproj.Orig and untar the one I created into /System/Library/User Templates/. Then I do a chown to root:wheel on my created English.lproj. This gets me the dock and all the settings I want with only one snag. When a new AD user logs in and opens a finder window, the favorites sidebar: Documents, Downloads, and Desktop don't work. I get an error I don't have permission to open them. If I right click on those links and click Show in Enclosing Folder, it takes me to the "setup" account's home folder.