Fix setuid

Previously I wasn't using the right syscall and the filesystem userids were
wrong, leading to the wrong permissions on the log files.