Override path to binary for particular user

Solution 1:

If the binary is in /usr/bin/binary and the script invokes the binary without specifying the full path, but instead relies on /usr/bin being in PATH then you can simply add the location of the new binary to the beginning of the user's PATH. Put something like this in their ~/.bashrc:

PATH=/mount/new_version:$PATH

For security reasons, scripts often specify the full path to binaries to prevent this kind of thing.

Solution 2:

If you have access to the binary you can backup it and create a symbolic link.

mv /urs/bin/binary /urs/bin/binary.bkp
ln -s /mount/new_version/binary /urs/bin/binary

[EDIT]

Sorry, didn't saw the change must be done for one user only.

You can create a function to be called instead of the binary.

Depending on how you execute the binary (full path or just name) you must create a suitable function, like:

# Full path
function /urs/bin/binary () { command /mount/new_version/binary "$@"; }
export -f /urs/bin/binary
# Name
function binary () { command /mount/new_version/binary "$@"; }
export -f binary

If the binary don't accept/need arguments, remove the "$@".

To automatize the function creation, put the function lines in the .profile file in the user home directory.