From: John Joyce Date: 2008-02-03T00:37:06+09:00 Subject: Re: Temporarily dropping root access On Feb 1, 2008, at 3:12 PM, Daniel Berger wrote: > > > On Feb 1, 1:05 pm, MenTaLguY wrote: >> On Sat, 2 Feb 2008 04:23:02 +0900, Daniel Berger >> wrote: >>> Hi all, >> >>> Say I've got a C extension with two rake tasks - 'build' and >>> 'install'. For the build task, if currently being run as root, I >>> would >>> like it to drop down to, say, the 'nobody' user. Obviously, I'm only >>> talking about Unix here. >> >> Generally speaking, you should be able to use setreuid to set the >> effective UID to 'nobody' while keeping the real UID as root. >> >> (Actually 'nobody' may not be a good choice depending on the Unix >> flavor; I believe it is something of a special case on HP-UX for >> example) > > Oh, and just curious, is there ever a time when you *would* want to > build as root? > > Thanks, > > Dan > Sure! Many installers run as root, so often building with make would require sudo, same can be for rake. Anytime something needs to write to a directory not owned by the user.