• Stars
    star
    113
  • Rank 308,432 (Top 7 %)
  • Language
    C
  • Created almost 10 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Execute scripts when a user logs in on Mac OS X.

LoginScriptPlugin

This is an implementation based on TN2228, Running At Login that allows you to execute scripts when a user logs in. It provides a replacement for LoginHooks (which have been deprecated) and have the advantage over LaunchAgents that it executes before any agents or applications are loaded, avoiding potential race conditions.

WARNING

The plugin is enabled by configuring the authorization database. Misconfiguration can lead to no one being able to log in at the login window. Make sure you have some way to recover in case of a mishap, e.g. ssh, ARD, or single user mode.

System Requirements

The plugin is currently tested on 10.9, but should work on 10.7 or newer.

Installation

Download and install the latest package.

Uninstallation

Configuration

Create the folder /Library/Application Support/LoginScriptPlugin and place your login scripts there. Make sure the folder and all the scripts are owned by root:wheel and not writable by anyone else. The plugin will execute scripts in this directory either before or after the user's home directory has been mounted, and either as root or the user that's logging in, determined by the script's name. The plugin looks for scripts that match the following patterns, in this order:

  • premount-root-*
  • premount-user-*
  • postmount-root-*
  • postmount-user-*

For example a script named postmount-user-com.example.redirect_library.sh will execute as the user logging in after the home directory has been mounted. The following arguments are passed to each script:

Variable Value Example
$1 UID 501
$2 GID 20
$3 Home /Users/ladmin

Please note that since the scripts are executing before the session has been fully initialized you can't count on regular shell variables being set to expected values. Notably $HOME, $USER are not set and $PATH is very rudimentary.

Scripts should return 0 to let the login proceed, or 77 (EX_NOPERM) to fail authorization.

License

Copyright 2014 Per Olofsson, University of Gothenburg. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

AutoDMG

Create deployable system images from OS X installer
Python
1,217
star
2

CreateUserPkg

This project has been archived and is no longer maintained
PostScript
262
star
3

Create-Recovery-Partition-Installer

Shell
244
star
4

MacModelShelf

A small Python module that gives you nice human readable Macintosh model names, e.g. "iMac (27-inch, Late 2009)", when given a serial number or model code.
Python
103
star
5

u4remastered

Ultima IV Remastered for the C64
Assembly
102
star
6

LoginLog

Display a log window over the login window.
Python
88
star
7

SkipAppleSetupAssistant

Disable OS X first boot Setup Assistant
Shell
63
star
8

AutoDMGUpdateProfiles

Scripts for maintaining AutoDMG's UpdateProfiles.plist
Python
59
star
9

ArcadeGameSelector

Amiga game menu
Eiffel
50
star
10

Scripted-Mac-Package-Creation

This project has been archived and is no longer maintained
Shell
35
star
11

fifogfx

Open source graphics card
KiCad Layout
31
star
12

MVPCStruct

Class for packing and unpacking C structs in Swift
Swift
27
star
13

CGTerm

C/G telnet client for C64 BBS's
C
25
star
14

iLife-repackaging

This project has been archived and is no longer maintained
Python
21
star
15

Profile-Manager-CLI

This project has been archived and is no longer maintained
Python
17
star
16

AutoDSNBI

This project has been archived and is no longer maintained
Shell
16
star
17

AsmAstar

A* pathfinding in 6502 assembler.
C
13
star
18

MacTech-2016

Build your first Mac app with Xcode
Objective-C
9
star
19

Ptolemy

Shell
8
star
20

extractinstalls

Generate installs key for Munki pkginfo files given an installer package.
Python
7
star
21

u4talk

Ultima IV Dialogue
HTML
7
star
22

AsmHeap

Heap data structure in 6502 assembler
C
5
star
23

MunkiReport-Python

Shell
5
star
24

magervalp.github.com

GitHub Pages
CSS
3
star
25

SimpleCLI

Command line interface for SimpleMDM script jobs
Python
3
star
26

DAFGU-Migration-Status

This project has been archived and is no longer maintained
Objective-C
3
star
27

SimpleMDMTools

Python
2
star
28

vbcc-conio

conio library for vbcc 6502 targets
C
2
star
29

DAFGU-rsync-wrapper

This project has been archived and is no longer maintained
Python
1
star
30

CHeap

Experimenting with priority queues using heaps for A*
Objective-C
1
star
31

MTB

Köpråd för din första mountainbike
1
star
32

SwiftHeap

Testing Swift's performance with my heap priority queue.
Swift
1
star