core: change the uid and gid for pid and pgid files

- use the user and group given to daemon to update ownership of pid and
  pgid files
- reported by Ovidiu Sas, FS#472