Setting up the use of the Solaris User directory and hard disk space

Source: Internet
Author: User
Tags chmod file system resource time limit touch root directory

Restrict User Directory usage space

Modify/etc/vfstab to change the mount options for the file system that need to be restricted to RQ

To the top of the file system, execute commands touch quotas and chmod quotas

Quotaon-v-A

Set the user-available space (Edquota user name)

Limit the user's hard disk use space

Unix as a multi-user system, it allows multiple users to use the system's resources, including the system's memory, CPU and hard disk. By default, the system does not limit the size of the hard disk space that each user can use, so if the user maliciously uses the hard drive, or if the user inadvertently consumes all of the hard disk space, it will cause other users to be unable to use the hard drive, resulting in degraded system performance and even a crash risk.

In fact, the quota series commands provided by UNIX can help us solve this problem, and these commands include:

Quota: Displays the user's hard disk limit and usage.

Edquota: Set the hard disk limit for each user.

Quotaon: Boot file system hard disk quota service

Quotaoff: Turn off File system hard disk quota service

Repquota: Displays current disk limit status

The way to configure this service is simple. But before using the hard disk limit service, we need to understand the two concepts of hard limit and soft limit. The so-called hard limit refers to the absolute limit of resource nodes and data blocks, and in no case allows users to exceed this limit; soft limit refers to the user can be within a certain time range (the default is one week, set in the/usr/include/sys/fs/ufs_quota.h file) Exceed the limit of soft limits and continue to request resources within a hard limit, while the system gives a warning message when the user logs on and continues to request the remaining time for the resource. If the time limit is reached, the user's hard drive is still more than the soft limit, the system will not allow users to request hard disk resources.

Understanding these two concepts, we can configure the hard disk limit service, we must first in the file system to limit the root directory to create a quotas file, the file owner should be root, and other users can not write to it. The method is:

# cd/home (enter file system root directory, note not system root directory, this example is/home directory)

# Touch quotas (Create an empty text with a name of quotas)

# chmod 644 Quotas (change file properties so that only root can write to it)

Then, we edit the/etc/vfstab file, find the file system for the hard disk quota service, and

The value of the Mount option field is set to RQ, and then the disk is exited.

After completing these two steps, we use the Edquota command to set the hard disk limit for each user, and enter the following command under root permissions:

#edquota username

The system automatically generates a temporary file and has the following contents:

Fs/users blocks (soft = 0, hard = 0) inodes (soft = 0, hard = 0)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.