programmatically manipulation environment variables of the calling shell

Diez B. Roggisch deets at nospam.web.de
Mon Mar 12 07:40:22 EDT 2007


Michal 'vorner' Vaner wrote:

> Hello,
> 
> On Mon, Mar 12, 2007 at 11:40:11AM +0100, Diez B. Roggisch wrote:
>> Maxim Veksler wrote:
>> > I'm trying to write a python script that would allow me to manipulate
>> > shell variables of the calling shell. I'm trying to write some logic
>> > that would know to add LD_LIBRARY_PATH to the users environment.
>> 
>> It's not possible, OS restrictions - you are not allowed to alter the
>> environment of a parent process.
> 
> Actually, you are able to modify only your own environment (and call a
> new process with any possible environment). And the restrictions seem to
> me rather technical - the process would have to change its behaviour
> each time it changes.

Not only technical - they are important security-wise - you could try and
make a parent process use a modified library that would e.g. authenticate
users without passwords.

Diez



More information about the Python-list mailing list