The virtual host often restricts the size of the user space and the number of files. These limits are implemented in QUOTA in Linux and FreeBSD. Here I said the method implemented under FreeBSD;
Open quota support
First need to modify the kernel to join the support for Quota
Machine I386
CPU I686_CPU
#ident generic
Ident CNOSVHOST
MaxUsers 0
Options quota # is this line.
After modifying, recompile the kernel.
Then join in /etc/rc.conf:
Enable_quotas = "yes"
Check_quotas = "yes"
This way, your system will use quota, you should join Quota's support by editing the properties of a file system of / etc / fstab.
The following FSTAB file sets the user quota and group quota on / pub file system.
# See the fstab (5) manual page for important information on automatic mounts # of network filesystems before modifying this file. # Device Mountpoint FStype Options Dump Pass # / dev / ad0s1b none swap sw 0 0 / dev / ad0s1a / ufs rw 1 1 / dev / adj CD9660 RO, NOAUTO 0 0 PROC / Proc Procfs RW 0 0
After setting the fstab file, do the following command to open Quota
# Quotacheck-AV
# repquota -a
Basically, the previous work has been done, and the rest is to edit the quota of the user.
Edit user quota
# Edquota C4ST will edit the quota setting of the user C4ST, which appears a text editor interface:
Quotas for User C4ST:
/ PUB: KBYTES IN USE: 3438, LIMITS (Soft = 100000, Hard = 100020)
Inodes in Use: 25, Limits (Soft = 25, HARD = 26)
We see that the settings are divided into two rows.
KBYTERS IN US: 3438 indicates that 3438KB LIMITS restrictions have been used (Soft = 100000 soft limit 100m, hard = 100020 hard limit)
Soft indicates that the user can actually use the size when this value is reached.
Inodes in Use: 25, Limits (Soft = 25, HARD = 26) This behavior can have the "file number" limit, of course, the value given by the example is not actually, the above setting,
Users can only create 26 files. In practical applications, you can adjust the value of Inodes as needed, for example, you have a text library-based program, such as LB5000 (a webbbs).
Some CGI Article Management and other systems, you have to make appropriate MLDE's HARD settings?
Common quota command
# Edquota -t The time setting before the quota user uses soft restrictions, DAYS, Hours, Minutes or Seconds can be the unit set, and the value is just reasonable.
Time Units May Be: DAYS, Hours, Minutes, or Secondsgrace Period Before Enforcing Soft Limits for Users:
/ PUB: Block Grace Period: 1 Day, File Grace Period: 1 Day
# Repquota -A report file system information about Quota.
Block Limits File Limits User Used Soft Hard Grace Used Soft Hard Grace Wheel - 2 0 0 - 1 0 0 - Operator - 128 0 0 - 2 0 0 - Mysql - 18 0 0 - 9 0 0 - vhostuser - 36164 100000 1000 - 342 1000 1005 - Block Limits File Limits User Used Soft Hard Grace Used Soft Hard Grace Root - 9136 0 0 - 12 0 - Mysql - 18 0 0 - 9 0 0 - Testmin - 18 1000 1050 - 9 1000 1005 - Web - 22152 0 0 - 122 0 0 - COMS_CN - 1550 0 0 - 177 0 0 - C4ST - 3438 100000 100020 - 25 25 26 22:56
# Quota: Display the user's disk usage and upper limit.
-g Displays the group distribution of the group where the user is located
-L does not show quota on the NFS system
-u Display user quota
-q Display use of use exceeds quotament
-v Check the user's quota settings
# Edquota -P test C4ST C4ST1 C4ST2 .....
Will copy the quota of the user TEST to the user C4ST C4ST1 C4ST2 .....
# Quotacheck -a This command can be performed regularly to check if all settings are normal (can be put in crontab).
Note: Any reprint or excerned, please indicate the article source (Chinese FreeBSD user group http://www.cnfug.org)
Author (translator) information:
PKKKingson, * NIX enthusiasts, especially like the BSD system, I hope that the day can work for pure technology, you can pass
CNFreeos@163.com Contact, Personal Site:
http://www.cnfreeos.org