How to limit user space in Linux

zhaozj2021-02-17  106

How to limit user space in Linux

linuxman

Back to〗 Forward〗

How to limit user space in Linux to limit user space in Linux -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------- Everyone has used NetWare ? I don't remember that the user space limit provided by NetWare can be used to limit the disk space that the user can use by command. The same function can also be provided in Linux. The specific method is as follows (Note the following steps are based on the release of Linux, version named RedHat 5.1): 1, kernel support, Linux's kernel version is more than 1.3.8X. If you are using the redhat 5.1 or similar distribution, the quota function in the kernel should have been compiled. 2, file system, Linux disk space limit must of course exist in space in the linux EXT2 format. It is recommended that if you want to limit the user's disk space in a critical server, it is best to make a separate partition for file systems to do disk space restrictions. If you provide 10 megabits of space for your personal homepage users, these users don't have to Telnet to my server, here I assign them a separate partition HDB1 and hung this partition in / usr / local / homepages inside. In addition, the disk space limit is performed on the non-root partition, which can be avoided to avoid the failure of the SA operation, resulting in a fault that the system cannot initiate (after the specific reason). 3. After the above preparation is to start modifying the system file, the disk limit in the kernel is started. Note that the following steps will have an error, which can be guided to the file system. If you limit the disk space for the root partition, it may cause the system to be unable to start (this is why I suggest you use the independent partition Causes of disk space limit trials). So you must see very very seriously, if you have any questions, please contact me. ※ Use VI modified / etc / fstab to make the system open disk space limit function for the specified partition. This is my original / etc / fstab main section / dev / hda5 ext2 defaults 1 1 1 1 1 This is the modified content / dev / hda5 ext2 Defaults 1 1 / dev / hda6 ext2 defaults, usrquota Grpquota 1 1 Note that there is no, the two instructions joined in the HDA6 configuration, which means open user-based spatial restrictions and group-based spatial restrictions. If you just need to use the user-based space limit, you can use only USRQUOTA. Similarly, if you just need to use a group-based space limit, you can only add Grpquota to defaults. Be careful not to turn wrong, otherwise the system will not be able to hill the corresponding partition. If you are using a non-root partition, you can use root to make disk space limitations, just! # $! $ # @%. ※ Next, it is necessary to generate Quota Record file in the root of the corresponding partition.

转载请注明原文地址:https://www.9cbs.com/read-31591.html

New Post(0)