ThisCalculator

Everyday

ACLs and Disk Quotas for Users and Groups

Updated · Standard formula, shown below

Yes, you can set access control lists (ACLs) and disk quotas for both individual users and groups on most modern operating systems, including Linux, Windows, and macOS. This article explains what ACLs and quotas are, how they work, how to set them up, and common pitfalls to avoid.

What Are ACLs and Why Use Them?

Access control lists (ACLs) extend the traditional Unix permission model (owner/group/others) by allowing you to grant or deny permissions to multiple specific users or groups on a single file or directory. For example, instead of setting a directory to be readable only by its owner and group, you can give read access to user Alice, write access to group Developers, and no access to everyone else. This is essential in shared environments where different collaborators need different levels of access to the same resources.

Disk quotas, on the other hand, limit the amount of disk space a user or group can consume. Quotas prevent any single user from filling up a shared filesystem, which can cause outages for everyone. They are commonly used on file servers, web hosting, and university systems.

How ACLs Work

ACLs are implemented as extended attributes on files and directories. On Linux, the setfacl and getfacl commands manage them. Each ACL entry consists of a type (user, group, mask, other), an identifier (username or group name), and a permission set (read, write, execute). The mask entry limits the maximum permissions that named users and groups can have, even if their individual entries specify more.

For example, to give user alice read and write access to a directory /shared, you would run:

setfacl -m u:alice:rw /shared

To give group developers read-only access:

setfacl -m g:developers:r /shared

To view the ACL:

getfacl /shared

On Windows, ACLs are managed via the Security tab in file properties, or with the icacls command. Windows ACLs are more granular, with permissions like "Read Attributes" and "Delete Subfolders and Files".

How Disk Quotas Work

Disk quotas track the amount of disk space and the number of files (inodes) each user or group owns. On Linux, quotas are enabled per filesystem in /etc/fstab with the usrquota and grpquota options, then activated with quotaon. You set limits with the edquota command, which opens a text editor where you specify soft and hard limits for blocks (1KB units) and inodes.

A soft limit is a threshold that triggers a warning; the user can still write until the hard limit is reached. After a grace period (default 7 days), the soft limit becomes enforced. A hard limit is absolute; the user cannot exceed it.

On Windows, quotas are set on a per-volume basis via the Quota tab in the volume’s properties. You can assign a default quota for all users and specific limits for individual users or groups.

Setting ACLs and Quotas: A Step-by-Step Guide

Here is a practical guide for a Linux system (the most common scenario).

  1. Ensure the filesystem supports ACLs and quotas. For ext4, mount with acl and usrquota options. Add them to /etc/fstab and remount.
  2. Create the quota database. Run quotacheck -cug /mountpoint to create the quota files.
  3. Turn on quotas. Run quotaon /mountpoint.
  4. Set user quotas. Run edquota -u username and edit the soft/hard limits for blocks and inodes.
  5. Set group quotas. Run edquota -g groupname and edit similarly.
  6. Set ACLs. Use setfacl to add entries, e.g., setfacl -m u:alice:rwx /shared.
  7. Verify. Use getfacl and quota -u username to confirm.

Common Mistakes and Pitfalls

One common mistake is forgetting the mask entry when setting ACLs. The mask defaults to the union of all named user/group permissions, but if you later add an ACL entry with fewer permissions, the mask may be reduced, inadvertently restricting existing entries. Always check the mask with getfacl and set it explicitly if needed.

Another pitfall is applying quotas to a filesystem that does not support them, such as some network filesystems. Quotas must be supported by the underlying filesystem (e.g., ext4, XFS) and the kernel.

When setting group quotas, note that the group quota counts all files owned by that group, regardless of which user created them. This can be surprising if multiple users share a group.

ACLs vs. Traditional Permissions: When to Use Which

Traditional Unix permissions (owner/group/other) are simple and sufficient for most cases where a file belongs to one user and one group. Use ACLs when you need to grant access to multiple specific users or groups without creating a new group for every combination. For example, a project directory may need to be readable by user Alice, writable by group Developers, and readable by user Bob, but not by anyone else. That is impossible with traditional permissions alone.

However, ACLs add complexity. They are harder to manage and can be confusing when combined with default ACLs on directories. For simple cases, traditional permissions are easier to understand and troubleshoot.

Performance and Security Considerations

ACLs and quotas have minimal performance overhead, but they do add metadata to files. On very large filesystems with millions of files, quota tracking can slow down write operations slightly. ACLs add extended attributes, which are stored in the inode or in a separate block, potentially increasing I/O.

Security-wise, ACLs can be a double-edged sword: they allow fine-grained control, but misconfiguration can accidentally expose sensitive data. Always review ACLs with getfacl and test with a non-privileged account. Quotas, if set too low, can cause applications to fail with disk-full errors, so choose limits based on actual usage patterns.

Alternatives to ACLs and Quotas

If ACLs become too complex, consider using group-based permissions with a well-designed group hierarchy. For example, create groups like project-read and project-write and add users to them. This is simpler but less flexible.

For quotas, alternatives include filesystem-level encryption with per-user keys (not a space limiter), or using logical volume management (LVM) to create separate volumes per user with a fixed size. This is heavier but provides hard isolation.

On network filesystems like NFS, quotas can be enforced on the server, but client-side enforcement is not possible. Some distributed filesystems (e.g., Lustre) have their own quota systems.

Frequently Asked Questions

Can I set an ACL for a group that doesn’t exist yet?

No, the group must exist in the system (in /etc/group or LDAP) before you can add an ACL entry for it. Otherwise, the system will not recognize the identifier.

Do ACLs work on all filesystems?

No. ACLs require filesystem support. On Linux, ext4, XFS, Btrfs, and ZFS support POSIX ACLs. FAT and NTFS (via FUSE) may have limited or no support. Check your filesystem’s documentation.

What is the difference between a soft and hard quota limit?

A soft limit is a warning threshold; the user can exceed it for a grace period (usually 7 days). A hard limit is absolute; once reached, no further writes are allowed. The grace period can be set per user or globally.

Can I set quotas for a group of users without a group quota?

Yes, you can set individual quotas for each user, but that requires manual configuration. Group quotas are more efficient if you want a shared pool of space for a team.

How do I check my current quota usage?

On Linux, use quota -u username or quota -g groupname. On Windows, right-click the volume, select Properties, then Quota, and it shows usage per user.

What happens if I delete a user who has a quota or ACL entry?

ACL entries for a deleted user may remain as unresolved IDs, which can cause confusion. It is best to remove ACL entries before deleting the user. Quota entries are usually cleaned up automatically, but you may need to run quotacheck to remove stale records.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.