From: Joe Van Dyk Date: 2005-11-23T09:25:00+09:00 Subject: what the heck (changing process uid question) My problem: When I fork a new process and set the UID of that process and want to create a log file that I redirect output into, I'm having difficulties getting the log file to be owned by the correct person. Below is a code snippet that demonstrates my problem. require 'ftools' fail "run this as root please" if Process.uid != 0 fail "usage: ruby #{ __FILE__ } was created by uid <#{ uid }>" raise "why the heck don't I own this?" if !File.owned? dir When I run this on my linux box, I get: crabbe@~$ id uid=7258(mz652c) gid=20(games) groups=20(games) crabbe@~$ sudo ruby a.rb 7258 asdf uid is 0 changing uid to 7258 uid is now 7258 Hopefully was created by uid <7258> a.rb:20: why the heck don't I own this? (RuntimeError) crabbe@~$ ls -ld asdf drwxr-xr-x 2 4294967294 4294967294 9 Nov 22 16:23 asdf