<p>I want a user-privileged (not root) process to launch new processes as user <code>nobody</code>. I've tried a straight call to <code>setuid</code> that fails with -1 <code>EPERM</code> on <code>Ubuntu 8.04</code>:</p>

<pre><code>#include &lt;sys/types.h&gt;
#include &lt;unistd.h&gt;

int main() { 
       setuid(65534);
       while (1);
       return 0;
}
</code></pre>

<p>How should I do this instead?</p>

As far as I know, you can't unless you're root or have sudo set up to allow you to switch users.  Or, you can have your executable have the suid bit set up on it, and have it owned by nobody.  But that requires root access too.