Mariners Mariners - 4 months ago 28
Linux Question

How to restrict a particular command in bash?

I have bash-3.2.tar.gz
I have all the tools needed to compile the bash. Now I need to restrict a command in the compiled bash binary, e.g. I want to restrict the command "kill" in the compiled bash binary. How to achieve this?

Thanks in advance.


It's not clear exactly what you're trying to do, so here are a few thoughts.

You can remove a command from bash before compiling it by editing the DEFSRC and OFILES variables in the builtins/ (before running configure).

You can disable a built in command using the enable command. For example, running enable -n kill would disable the builtin kill command, so that running kill would instead look for a file named kill in your $PATH.