Simple way of blocking a program on CentOS 6?

One of our user has been compiling their own program within their home directory. Normally we don't mind, but this particular program has a memory leak and eats into the SWAP. We have told this user many times not to run the program and yet she wouldn't listen.

Is there a simple way of blocking a certain program from running?


Two ways:

  • Use limits.conf to assign the maximum allotted memory per process for that user
  • Create a cgroup for that user in order to limit their total memory usage

More details here: https://unix.stackexchange.com/questions/34334/how-to-create-a-user-with-limited-ram-usage


You are trying to solve a human problem via technical means. This person is knowingly violating policy. The appropriate response is to (as @ceejayoz wisely mentioned above) get rid of that user, or at the very least, remove access to the system in question and any others like it.


If you have home directories on a separate partition you can mount the partition with noexec. Although I'd also agree to just ban the user.