Tuesday, May 1, 2007

Passing environment variables to sudo

A user on the Fink mailing list wrote to tell me that instead of editing /etc/sudoers to maintain the PERL5LIB variable, you can optionally pass it through on the command line, like this:

sudo env PERL5LIB=$PERL5LIB cpan

8 comments:

jude said...

Thanks. This made my life easier today.

Anonymous said...

Works well where setenv set and export didnt.

Thanks !

Chrelad said...

This helps a lot, thank you!

Ganesh said...

Thanks a lot for the tip.

Yo said...

Saved me some time... Thanks!

Kurta László said...

Thanks!

Kurta László said...

Thanks! It works :)

vijay said...

thanks for the tip..