When using a systemd user instance (
systemd --user), every user-created daemons are owned by this instance.
- Let's create a daemon:
nohup sleep 100 0<&- &>/dev/null &. It has PID
12549. Kill the parent terminal process (or directly the shell) so that it becomes a daemon
The new parent of the process is the systemd user instance:
UID PID PPID C STIME TTY TIME CMD phylliade 12549 20280 0 17:21 ? 00:00:00 sleep 100 phylliade 20280 1 0 09:23 ? 00:00:00 /usr/lib/systemd/systemd --user
So, how is this happening? When a process parent dies, the kernel normally assigns init (here the main systemd) as its new parent; Is the system systemd then assigning the daemon to the user systemd?