im running a clearOS server on my local network (small company of 10 developers) we use it as a developement server to test our work and show it to clients in test process each developer has a unique username and password to access the ftp/http/smb. the problem is when one of the developer runs a non safe code (lets assume it is a php code) like running a infinite loop! the server completely crashes for all and im not able to identify who is the the faulty developer!! how can that be solved ? thanks in advance
My server's info
- clearOS server
- RAM 16GB
- SSD 1TB (2 partitions)
Apps installed:
- proftpd,
- gitlab,
- apache,
- mariadb
Users:
- physical root user and
- 10 virtual user (using ldap) each user has a unique password
Your problem(s)
You've stated your main problem as
Because development code can always crash or hang, you are effectively dealing with two different problems:
If you solve the second problem, you still need to solve the first; but if you solve the first, you don't need to solve the second one anymore, so I focus on solving the first here (also, solving problems without confronting people about bad things is always easier and gets less confrontation).
Possible solutions
You have three main paths to choose from when isolating user actions from one another:
ulimit
, I just want to add that you have to make sure that your applications also use those users (instead of generic daemon users for each service) and that they do not want to start processes with other user accounts. Because of this downside this approach is seldom used today, except for simple things like build scripts without a continuous delivery infrastructure.Of course, combinations are always possible, as the approaches work on different layers. For example, you could use containers so that everyone has his own webserver, but let all users use the same database to save resources (database access is faster than with several different databases), limited by database quotas.
What do do in your case?
As you see, the possibilities are many and each of them is considerable effort to implement, so you need to narrow it down:
As a preventive measure you should look into ulimits if you want to set specific set of limits to users. You can set process / CPU / memory limits.
Please refer this link
The other way is to monitor the resource usage of the system with an external monitoring tool,( most common example : nagios/nrpe ) which can alert you in case a resource threshold is crossed.