Search code examples
linuxstartupfedora16systemd

Units from non root user (for commands start/stop/enable/disable)


I want to execute my scripts at boot time through systemd (OS is Fedora Core 16) from some non-root user (e.g. michael).

I don't need root privileges - I only want to run at boot time and at shutdown time some of my units in systemd. And I don't want to turn on a root user for this. I only want to use power of systemd syntax of units for starting and watching for my process (of course without root access). Is it possible?

I didn't find any help in the documentation. I only found in systemd(1) -> DIRECTORIES -> "User unit directories":

$ pkg-config systemd --variable=systemduserunitdir
/usr/lib/systemd/user

But the /usr/lib/systemd/user is:

drwxr-xr-x. 2 root root

I cannot imagine how I can use this directory as a non-root user...


Solution

  • Create a user systemd unit file for 'michael'.

    Here's the magic to ensure users systemd process will kick off at boot instead of at login:

    loginctl enable-linger michael
    

    Full details