News for hackers. Stuff that matters.
Re:Linus: “I no longer feel like I can trust ‘init’ to do th... by eridius on Monday July 10, 2017 @03:14AM (#14733958)
> do you define a user job that runs in the background even when the user's not logged in?

Well, you can't. Only administrators get to define things that run when the user isn't logged in. That's an intentional decision.

> How do you define a user job that runs if the user logged in via SSH

Offhand, I don't think you can do that either, though I haven't researched this particular angle. And it would be surprising to me that SSH'ing into a machine would trigger daemons anyway.

Re:Linus: “I no longer feel like I can trust ‘init’ to do th... by JdeBP on Monday July 10, 2017 @04:00AM (#14734126)
> And it would be surprising to me that SSH'ing into a machine would trigger daemons anyway.

You might want to find out about systemd, then, which does exactly this. (-:

A PAM hook indirectly causes a per-user systemd instance to be created at login and terminated at logout, which triggers all of the per-user daemons that the account has.

If one has a user that is used for lots of little SSH sessions, hundreds of thousands of times a day, the overhead of starting up and tearing down the per-user systemd for each one, not least in terms of the log noise, becomes a serious consideration, and one has to learn the systemd mechanisms for making the user a "lingering" one.

Re:Linus: “I no longer feel like I can trust ‘init’ to do th... by eridius on Monday July 10, 2017 @01:41PM (#14738080)
For an OS that is frequently used headless, starting up per-user daemons on SSH makes some amount of sense. macOS is designed to be primarily GUI-driven, rather than primarily used headless, so it makes more sense for macOS to avoid the issue that you describe by not supporting launching per-user daemons on SSH.
Re:Linus: “I no longer feel like I can trust ‘init’ to do th... by AceJohnny2 on Monday July 10, 2017 @02:35PM (#14738498)
I was assuming administrative control of course. How, as the administrator, do you define such user jobs? It's not a permissions issue, its a launchd job configuration issue.
Re:Linus: “I no longer feel like I can trust ‘init’ to do th... by eridius on Monday July 10, 2017 @06:14PM (#14740156)
As an administrator, you can place jobs into /Library/LaunchDaemons to run always, or /Library/LaunchAgents to run per-user when a user is logged in.