OS X: Run script at Login screen with FileVault on

1

How to run a script at Login screen (BEFORE user types password to log in)?

I have tried launchctl and place the script under both:

/Library/LaunchDaemons/
/Library/LaunchAgents/

Still the script is executed AFTER log in.

Am I missing something?

Edit:

  • I tried /Library/StartupItems also didn't work. Is the LaunchDaemons supposed to launch after Login or before. Have anyone successfully make it run before Login?
  • I'm running on Yosemite.

An Phung

Posted 2014-11-01T10:03:56.853

Reputation: 93

Do you mean whenever the login screen is shown, or just once after booting your Mac? – Arjan – 2014-11-01T10:30:31.313

Either of them is ok, just before the user log in. Calling the script once, or whenever (multiple times) are both fine. – An Phung – 2014-11-01T12:19:54.437

are you talking about login after boot? or do you mean the password right afterstarting the computer? As the later is requesting the password to unlock your filevaulted harddrive nothing on that harddrive can be executed before. – heiglandreas – 2014-11-01T19:47:32.407

As in my computer, I only have to enter 1 password at login screen. (After pressing power button -> Apple logo -> Login screen -> Enter password -> Load to desktop) – An Phung – 2014-11-02T04:14:00.230

Answers

0

Add this to your crontab:

@reboot /path/to/file.sh

The script will be run once on boot before login.

grg

Posted 2014-11-01T10:03:56.853

Reputation: 1 499

Still execute after logging in. – An Phung – 2014-11-01T15:15:44.690

0

After trying many the ways, I realize that FileVault might cause this behavior. Because FileVault requires password in order to decrypt the data, we cannot do anything before entering the password.

This is a conjecture, if someone has any information about this, please feel free to confirm.

If anyone has a work around, please feel free to help.

An Phung

Posted 2014-11-01T10:03:56.853

Reputation: 93