问题描述
由于有人告诉我,如果我的计算机上的用户将创建无限"数量的文件夹/文件(甚至是空的),这可能会导致我的计算机变慢得多(甚至卡住),因此我想限制最大值用户可以创建的文件/目录数.
Since I have been told that if a user in my computer will create "infinite" number of folders / files (even empty) it can cause my computer to become much much slower (even stuck), I want to limit the maximum number of files/directories that user can create.
恐怕一个用户将尝试创建大量文件,这将对所有其他用户构成问题,因此这将是一个安全问题,我该怎么做,如何限制每个用户可以创建的文件/目录的最大数量?
I'm afraid that one user will try to create a huge number of files and it will become a problem for all the other users, so it will be a security issue,How do I do that, how do I limit the max number of files/directories each user can create?
推荐答案
这是为配额设计的.您可以使用文件系统配额对每个用户和/或每个组强制执行以下限制:
This is what quotas are designed for. You can use file system quotas to enforce limits, per user and/or per group for:
- 可以使用的磁盘大小空间量
- 可以使用的块数
- 可以创建的索引节点数.
inode的数量实际上会限制用户可以创建的文件和目录的数量.
The number of inodes will essentially limit the number of files and directories a user can create.
关于如何在许多来源中配置文件系统配额,有大量高质量的文档,我建议您进一步阅读:
There is extensive, very good quality documentation about how to configure file system quotas in many sources, which I suggest you read further:
- https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-disk-quotas.html
- https://wiki.archlinux.org/index.php/disk_quota
- http://www.ibm.com/developerworks /library/l-lpic1-v3-104-4/
- http://www.firewall.cx/linux-knowledgebase-tutorials/linux-administration/838-linux-file-system-quotas.html
- https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-disk-quotas.html
- https://wiki.archlinux.org/index.php/disk_quota
- http://www.ibm.com/developerworks/library/l-lpic1-v3-104-4/
- http://www.firewall.cx/linux-knowledgebase-tutorials/linux-administration/838-linux-file-system-quotas.html
这篇关于如何限制用户可以在Linux中创建的文件夹的最大数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!