Issue
I need to run a Python script from within bash in a way so it does not have access to any environment variables or system files/configurations. This due to an AWS boto3 client that tries to read configuration information from the environment and/or a config file.
Searching only results in how to access environment variables.
Is what I am looking for possible, and if so how?
Solution
Run your command with chroot
. For example, if you execute
chroot ~/newroot python yourscript.py
and your script tries to access /usr/lib/some_config.txt
, it will actually try to open ~/newroot/usr/lib/some_config.txt
. As far as your script knows, ~/newroot
is the root of the local filesystem.
Answered By - chepner
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.