scsi
Verified User
- Joined
- Aug 19, 2008
- Messages
- 4,531
This guide is to create a limit on the amount of processes directadmin users can run at a single time. It uses /etc/security/limits.conf
This example would limit all directadmin users to 20 processes max.
If you want to limit to a different number of processes change the 20 in user_create_post.sh to a different number.
Hopefully its useful to someone. I had to create this because of some abusive users.
1. Create the following file if it doesnt already exist: /usr/local/directadmin/scripts/custom/user_create_post.sh
Insert the following code:
Save the file and run the following commands:
2. Create the following file if it doesnt exist: /usr/local/directadmin/scripts/custom/user_destroy_post.sh
Insert the following code:
Save the file and run the following commands:
Thats it. Enjoy.
This example would limit all directadmin users to 20 processes max.
If you want to limit to a different number of processes change the 20 in user_create_post.sh to a different number.
Hopefully its useful to someone. I had to create this because of some abusive users.
1. Create the following file if it doesnt already exist: /usr/local/directadmin/scripts/custom/user_create_post.sh
Insert the following code:
Code:
#!/bin/sh
#Add user to /etc/security/limits.conf
echo "$username hard nproc 20" >> /etc/security/limits.conf
Save the file and run the following commands:
Code:
chown diradmin:diradmin /usr/local/directadmin/scripts/custom/user_create_post.sh
chmod 750 /usr/local/directadmin/scripts/custom/user_create_post.sh
2. Create the following file if it doesnt exist: /usr/local/directadmin/scripts/custom/user_destroy_post.sh
Insert the following code:
Code:
#!/bin/sh
# Remove user from limits.conf
sed -i '' -e "s/"$username.*"//g" /etc/security/limits.conf
Save the file and run the following commands:
Code:
chown diradmin:diradmin /usr/local/directadmin/scripts/custom/user_destroy_post.sh
chmod 750 /usr/local/directadmin/scripts/custom/user_destroy_post.sh
Thats it. Enjoy.
Last edited: