Hi all, I can use some hints on running a daemon as a user. Nixos creates the user, and the job.preStart makes sure the directory below /var/lib is owned by that user.
The daemon itself doesn't have support for specifying a user/group, so I use: su username -c "mydaemon" This works fine, but as a consequence, I have 1 extra process (su) running the whole time. So I tried: su username -c "mydaemon &" Which takes care of the extra process, but now, my daemon process is the result of 3 forks, so upstart isn't able to track it and ends up with the wrong pid. I think this is somewhat strange, because without the &, the daemon runs as the first fork (first process is "su", next is my daemon). So I don't fully understand why & causes 2 extra forks. Probably it causes some inbetween shell process. Anyway, I don't think su is the best way to do this. I can try to setUID the binary, but that means writing to the nix store, which is probably bad as well. Any hints? Thanks, Mathijs _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev