{
	"id": "6de030ba-fcd6-40df-af1a-fa4fb8b04b94",
	"created_at": "2026-04-06T00:17:39.301601Z",
	"updated_at": "2026-04-10T03:20:04.109378Z",
	"deleted_at": null,
	"sha1_hash": "df968f5289c56321558eb78e33e92c1d0378c2ad",
	"title": "Customizing Login and Logout",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 53153,
	"plain_text": "Customizing Login and Logout\r\nPublished: 2016-09-13 · Archived: 2026-04-05 22:01:38 UTC\r\nThis appendix describes technologies that fill very specific roles. As a rule, if your goal is to have a process\r\nrunning while the user is logged in, you should almost always use either a launch daemon or agent, as described in\r\nCreating Launch Daemons and Agents.\r\nRunning Agents Before Login\r\nMost software that displays a user interface does not run prior to the user logging in. However, in some rare cases,\r\nit may be necessary to create a graphical agent that does.\r\nBy default, OS X does not allow any application to draw content prior to login. If you need to do so, your agent\r\nmust call the setCanBecomeVisibleWithoutLogin: method on its windows. For more information, see the\r\ndocumentation for that method and the PreLoginAgents sample code.\r\nAuthentication Plug-Ins\r\nAuthentication plug-ins are the recommended way to perform tasks during the login process. An authentication\r\nplug-in executes while the user is logging in, and is guaranteed to complete before the user is allowed to actually\r\ninteract with his or her account.\r\nYou might write an authentication plug-in if you need to programmatically reset an account to a predetermined\r\nstate, perform some administrative task such as deleting caches to reduce server utilization, and so on.\r\nTo learn more about writing an authentication plug-in, read Running At Login.\r\nLogin and Logout Scripts\r\nOne way to run applications at login time is to launch them using a custom shell script. When creating your script\r\nfile, keep the following in mind:\r\nThe permissions for your script file should include execute privileges for the appropriate users.\r\nIn your script, the variable $1 returns the short name of the user who is logging in.\r\nOther login actions wait until your hook finishes executing. Therefore, your script needs to run quickly.\r\nUse the defaults tool to install your login script. Create the script file and put it in a directory that is accessible\r\nto all users. In Terminal, use the following command to install the script (where /path/to/script is the full path\r\nto your script file):\r\nsudo defaults write com.apple.loginwindow LoginHook /path/to/script\r\nhttps://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CustomLogin.html\r\nPage 1 of 2\n\nTo remove this hook, delete the property:\r\nsudo defaults delete com.apple.loginwindow LoginHook\r\nUse the same procedure to add or remove a logout hook, but type LogoutHook instead of LoginHook .\r\nBootstrap or “mach_init” Daemons\r\nIn OS X v10.3, a mechanism similar to launchd was supported to allow the launching of programs either at\r\nsystem startup or on a per-user basis. The process involved placing a specially formatted property list file in either\r\nthe /etc/mach_init.d or the /etc/mach_init_per_user.d directory. Such daemons also are sometimes referred\r\nto as mach_init daemons.\r\nThe use of bootstrap daemons is deprecated and should be avoided entirely. Launching of daemons through this\r\nprocess may be removed or eliminated in a future release of OS X.\r\nIf you need to launch daemons, use the launchd facility. If you need to launch daemons on versions of OS X that\r\ndo not support launchd , use a startup item.\r\nSource: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CustomLogin.html\r\nhttps://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CustomLogin.html\r\nPage 2 of 2",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"references": [
		"https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CustomLogin.html"
	],
	"report_names": [
		"CustomLogin.html"
	],
	"threat_actors": [],
	"ts_created_at": 1775434659,
	"ts_updated_at": 1775791204,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/df968f5289c56321558eb78e33e92c1d0378c2ad.pdf",
		"text": "https://archive.orkl.eu/df968f5289c56321558eb78e33e92c1d0378c2ad.txt",
		"img": "https://archive.orkl.eu/df968f5289c56321558eb78e33e92c1d0378c2ad.jpg"
	}
}