From: Daniel Berger Date: 2009-01-28T23:01:23+09:00 Subject: Re: Super User Can't Change UID? James Gray wrote: > On Jan 27, 2009, at 5:11 PM, James Gray wrote: > >> Why would the super user not be able to switch UID's? >> >> $ sudo ruby -r etc -e 'Process.uid = Etc.getpwnam("james").uid' >> Password: >> -e:1:in `uid=': Operation not permitted (Errno::EPERM) >> from -e:1 > > Another data point on this odd issue: Apple's bundled Ruby (I'm on OS > X) works: > > $ sudo /usr/bin/ruby -r etc -e 'Process.uid = Etc.getpwnam("james").uid' > Password: > $ > > It's just the Ruby I built that fails. How could I have messed this up > in the build? Are you on 10.4.x? If I had to guess, I'd bet Apple replaced setreuid() with seteuid(), but that's a guess. I've never really understood the way OS X manages users. My own account is not in /etc/passwd, but shows up in NetInfo. Regards, Dan