From: Gregory Seidman Date: 2008-05-20T04:46:22+09:00 Subject: Re: sudo ruby loosing environment? On Tue, May 20, 2008 at 04:07:13AM +0900, Trans wrote: > My Ruby installation is from the Ubuntu package repository. Yesterday, > I upgraded my system to Heron and since then one of my Ruby scripts > stopped working. I traced the problem to this: > > $ ruby -e"p ENV['ROLL_PATH']" > "/home/trans/Company/TigerOps/programs" > > $ sudo ruby -e"p ENV['ROLL_PATH']" > nil > > At first I though it might have something to do with sudo itself, but: Yes, it's sudo. Your test is flawed. > $ echo $ROLL_PATH > /home/trans/Company/TigerOps/programs > > $ sudo echo $ROLL_PATH > /home/trans/Company/TigerOps/programs $ROLL_PATH is interpreted by the shell before sudo is ever invoked. > So that's not it. Anyone have any idea what's going on? [...] This is unrelated to Ruby or Ubuntu. This is how sudo works. Read the sudoers man page, looking for env_keep. You will need to edit the /etc/sudoers file (with visudo, not directly). > Thanks, > T. --Greg