H
Henry Hollenberg
Hello,
I have written a script that uses environment variables set during
a particular users login in ".bash_profile" and ".profile".
I have changed to that users uid and gid in my python script using:
import os
os.setegid
os.setgid
os.seteuid
os.setuid
but I still am not picking up the needed environment. When I run:
os.environ I can see that I still have the environment of the user
that owns the python script.
I would like to maintain the original script owner but somehow pick up
the
correct environment for the targeted user. Several options looked to
create
an environment in a sub-process which I don't think is the correct
solution.
I could of course cut and paste the values from ".bash_profile" &
".profile"
but figured there is probably a better, cleaner way to do the same.
Searched this forum with no luck and checked several python
references.
What is the best practice to achieve this goal?
Thanks, Henry Hollenberg
I have written a script that uses environment variables set during
a particular users login in ".bash_profile" and ".profile".
I have changed to that users uid and gid in my python script using:
import os
os.setegid
os.setgid
os.seteuid
os.setuid
but I still am not picking up the needed environment. When I run:
os.environ I can see that I still have the environment of the user
that owns the python script.
I would like to maintain the original script owner but somehow pick up
the
correct environment for the targeted user. Several options looked to
create
an environment in a sub-process which I don't think is the correct
solution.
I could of course cut and paste the values from ".bash_profile" &
".profile"
but figured there is probably a better, cleaner way to do the same.
Searched this forum with no luck and checked several python
references.
What is the best practice to achieve this goal?
Thanks, Henry Hollenberg