Skip to main content
added 146 characters in body
Source Link
user10489
  • 2.1k
  • 2
  • 9
  • 15

There are some issues with this that will prevent it from working. Here's the issues, and some possible alternate solutions.

  • PATH is an environment variable, which is separate in the memory of each executable. You can only change future paths, not ones in currently existing processes. (But the process can change its own path, e.g., a shell.)

  • You can just put that directory (or a symlink to it) in your path and it will always be there. However, most shells hash the executables in the path, so you'd have to tell the shell to rebuild that (hash -r in bash) after mounting. Note that probably only interactive shells have an issue with this, and normal executables should search every directory in the path every time.

  • As an alternative, you could populate the bin directory under the mount point with fake things or things similar to what is in the LUKS partition (but not secret), so that the shell hashes them, and then it will run the secret alternative when the LUKS volume covers the mount point. You might want to choose a less obvious path for mounting it though.

There are some issues with this that will prevent it from working. Here's the issues, and some possible alternate solutions.

  • PATH is an environment variable, which is separate in the memory of each executable. You can only change future paths, not ones in currently existing processes. (But the process can change its own path, e.g., a shell.)

  • You can just put that directory (or a symlink to it) in your path and it will always be there. However, most shells hash the executables in the path, so you'd have to tell the shell to rebuild that (hash -r in bash) after mounting.

  • As an alternative, you could populate the bin directory under the mount point with fake things or things similar to what is in the LUKS partition (but not secret), so that the shell hashes them, and then it will run the secret alternative when the LUKS volume covers the mount point. You might want to choose a less obvious path for mounting it though.

There are some issues with this that will prevent it from working. Here's the issues, and some possible alternate solutions.

  • PATH is an environment variable, which is separate in the memory of each executable. You can only change future paths, not ones in currently existing processes. (But the process can change its own path, e.g., a shell.)

  • You can just put that directory (or a symlink to it) in your path and it will always be there. However, most shells hash the executables in the path, so you'd have to tell the shell to rebuild that (hash -r in bash) after mounting. Note that probably only interactive shells have an issue with this, and normal executables should search every directory in the path every time.

  • As an alternative, you could populate the bin directory under the mount point with fake things or things similar to what is in the LUKS partition (but not secret), so that the shell hashes them, and then it will run the secret alternative when the LUKS volume covers the mount point. You might want to choose a less obvious path for mounting it though.

Source Link
user10489
  • 2.1k
  • 2
  • 9
  • 15

There are some issues with this that will prevent it from working. Here's the issues, and some possible alternate solutions.

  • PATH is an environment variable, which is separate in the memory of each executable. You can only change future paths, not ones in currently existing processes. (But the process can change its own path, e.g., a shell.)

  • You can just put that directory (or a symlink to it) in your path and it will always be there. However, most shells hash the executables in the path, so you'd have to tell the shell to rebuild that (hash -r in bash) after mounting.

  • As an alternative, you could populate the bin directory under the mount point with fake things or things similar to what is in the LUKS partition (but not secret), so that the shell hashes them, and then it will run the secret alternative when the LUKS volume covers the mount point. You might want to choose a less obvious path for mounting it though.