Scrubbing the environment Processes you call via exec inherit your environment unless explicitly told not to. Use 'execle' in C -- you can send it a array of environment variables. In Perl, do a fork, clean up %ENV, and then exec; $NEWENV{TERM} = $ENV{TERM}; $NEWENV{EDITOR} = $ENV{EDITOR}; %ENV = %NEWENV; exec "/bin/program", "arg1", "arg2", ... ; Always best to create an empty environment and include necessary values, rather than removing values.