Linux – Preventing users from running certain programs

linuxpermissionsSecurity

Is it possible to prevent users from running certain programs on their Linux computers? Is there a whitelist method? A blacklist?

Best Answer

The simple solution may be to simply remove execute permissions on system binaries. If you want to prevent users from compiling things or running things from directories they have write access you can create a separate partition and mount those file-systems with the noexec option.

man mount (noexec option)

Do not allow direct execution of any binaries on the mounted file system. (Until recently it was possible to run binaries anyway using a command like /lib/ld*.so /mnt/binary. This trick fails since Linux 2.4.25 / 2.6.0.)

I believe another way to accomplish this you would need to use something like AppArmor or SELinux.