Process IO redirection
I want to make is so that any process run in the current shell, if it tries to access (read/write) a certain filesystem path, it will get redirected to somewhere else. So for example:
Code:
$ bash I have been researching this for awhile now and can't figure it out. I am pretty sure there is a technical term for this (other than IO redirection which usually just give results for 'echo hi > file' on Google). Any help is greatly appreciated. |
Make /this/path/to a symlink to /that/path or another hardlink to the same file as /that/path?
|
Yes I want basically that, but I want it to only be for the current shell. Everything else would still write to the path /this/path/to.
|
Code:
bash -r |
How would I do this with bash -r?
Chroot looked promising, but it has to be done as... root and it makes everything else disappear to the program. |
In the base setup, you can't.
The current process uses the kernels context of the user environment - and that is started at the login. File paths are strictly global. The only "process" reference is the "current working directory". Now environment variables can be set up... but the process has to know how to use them (most don't). The most frequently used of these is PATH, LD_LIBRARY_PATH, LD_PRELOAD - which are interpreted by a runtime library (PATH), or the process loader (result of exec system call). What you are asking for is additional complexity in the runtime library - (as in how should it identify when something is redirected and when it isn't). Symbolic links are global, not process specific. Plan 9 has some of this - but it is still very heavy handed about it (bind mounts are part, but bind mounts are also global unless you have created/activated namespaces for a process...) ref: http://uwsgi-docs.readthedocs.org/en...amespaces.html |
Ok, well thanks for the info.
|
All times are GMT -5. The time now is 04:53 AM. |