Let’s say you are working on a project with multiple computers and users. You may want that some commands work only on a restricted set of user accounts.
You may want to restrict a newbie from using dangerous commands that could harm the project files. A solution to implement this feature is as follows:
1. Make a directory for every user (do_not_run.$HOSTNAME)
2. Put shell scripts with the same name as the command to be blocked/restricted in the folder. Make these scripts print an error to the stderr that this operation is not permitted for the user.
echo -e “\aYou are not allowed to perform this action.” 1>&2
\a or 07 provide an audible ring to notify users of error
3. Update the PATH environment variable to include your directory BEFORE the directory in which the restricted commands are placed.