From: Bruce Woodward Date: 2005-08-25T18:46:19+09:00 Subject: Re: getuid irb(main):004:0> if Process.euid != 0 irb(main):005:1> puts "you are not root" irb(main):006:1> end you are not root => nil On 8/25/05, Leslie Viljoen wrote: > Hello everyone! > > I am struggling to detect in a script whether the current user is root or > not. Etc.getlogin seems to return my unpriveleged username even after > I have done an 'su' or run the script with 'sudo' to become root. > > All I really need is: > > if Etc.getuid != 0 > puts "You are not root" > exit > end > >