But it's very inconvenience as most server services are auto start. Anyway, there is an easier way to get this problem resolve. Linux allows us to set the default priority for all processes for a specific user. By giving www-data user a lower priority, I can ssh into the server even if it's under attack. Assuming that we have sufficient memory.
sudo vi /etc/security/limits.confThe configuration syntax is as follow:
[username] [hard|soft] priority [nice value]
Insert the following line:
www-data hard priority 10Now, reboot the server.
To verify that you've done it correctly, run top:
Expected results should be similar to this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ GROUP COMMAND 1295 www-data 20 10 33688 6388 2544 S 2 0.2 0:00.32 www-data apache2 1296 www-data 20 10 33064 6100 2492 S 2 0.2 0:00.35 www-data apache2
No comments:
Post a Comment