From: Jonathan Nielsen Date: 2010-04-05T01:08:44+09:00 Subject: Re: $SAFE=0 for setuid? > From most documentation I see that $SAFE is automatically set to 1 if > you run ruby as root. Not entirely true, it sets $SAFE to 1 if you run it with setuid, but just running as root $SAFE will still be 0. > I need $SAFE=0 for pcap to function, however I also need to run it with > root privileges for it to function, but as soon as setuid is used, $SAFE > changes to 1. > > Is there a way to have the safety level be overridden to 0 with setuid > active? Otherwise I don't see how a library like pcap can be used. If you need to run it setuid, I found some C code that claims to be able to do this (with lots and lots of warnings that it's a bad idea and could damage your system) here: http://www.justskins.com/forums/setuid-wrapper-71480.html And yeah, it really is a bad idea to use that code... terribly insecure. Just execute it as root with sudo or su unless you REALLY need setuid. -Jonathan Nielsen