How to use ulimit utility to restrict users?

You can use ulimit command to prevent users from abusing system resources. Below I will touch two of the options;

1) Max User Processes: Once you set this, users wont be able to create processes more than this number. For instance:

For this change to take effect you must add this line in /etc/profile so that once the user logs out and logs in, new changes will be applied and this command will set the hard limits which a standard user cannot exceed.

Be careful about your limits. In regards to max-user-proc limit, if you set it too low you may receive such an error even during login;

Because even bash shell cannot be forked. I even saw that even though my user has 80 processes in total, setting this value to 150 caused this fork error during login. There must be something taken into account as well but I dont know at the moment what that really is.

2) Open Files: This is the max number of files a user can open. To see the hard and soft limits run;

Hard limits are those set by the root user and no user can exceed this limit but soft limits can be set by an ordinary user.

TIP: if you want to change/display max number of open files in system wide, you can look at the file

If you want to set limits per user, modify the file;

If you look into this file you will find pretty nice descriptions of what each option is for.

Below I have also quoted meaning of ulimit parameters from bash manual for quick reference

You have a feedback?