Disk quotas sound straightforward: set a limit, reject uploads that exceed it. In practice there are two decisions that matter more than the number itself. First, should the server block the transfer or just warn about it? Second, what does the user actually see when the limit is reached?
The problem quotas solve
Without quotas, every user on the server shares the same disk. One user uploading a batch of large files can fill the volume and break uploads for everyone else. Worse, the failure mode is ugly - writes fail partway through, staging files pile up, and the admin's first sign of trouble is a page at 2 AM.
A quota puts a ceiling on each user's home directory. The server tracks how many bytes a user has consumed, and when the next write would push them over the line, it decides what to do.
Hard limits: the upload stops
A hard limit means the server rejects the write that would exceed the quota. The upload does not complete. In Stylus SFTP Server, the quota manager (DiskQuotaManager) checks the reservation on every write during the upload. When the running total - existing files on disk plus bytes written so far - would exceed the configured limit, it throws a QuotaExceededException. The SFTP subsystem translates that into an SSH_FX_FAILURE response, and the staging file is discarded.
What the user sees depends on their SFTP client. OpenSSH's sftp prints general failure. WinSCP shows a dialog with the server's error message. Cyberduck displays the failure in its transfer log. In every case, the transfer stops and the partial file never appears in the user's home directory.
This is the right default for production. The user gets an immediate signal that they need to clean up or ask the admin for more space. No ambiguity, no surprise disk-full events downstream.
Soft limits: the upload continues, the server warns
A soft limit lets the upload complete even when it exceeds the quota. The server logs a warning - visible in the server log and the audit trail - but does not interrupt the transfer. The user's SFTP client never sees an error.
Soft limits are useful in two situations. The first is a monitoring phase: you are rolling out quotas for the first time and want to see who would be affected before you start blocking anyone. The second is a grace policy: you want to know when users are over their allocation, but you do not want a quota violation to break an automated job at midnight.
What the configuration looks like
Quotas are configured in filesystem-config.xml with two elements:
<quota>
<default-limit-bytes>1073741824</default-limit-bytes>
<enforcement>hard</enforcement>
</quota>
default-limit-bytes sets the global ceiling in bytes - the example above is 1 GiB. enforcement is either hard (reject) or soft (warn). That is the entire configuration for a uniform quota across all users.
For users who need a different limit, a per-user override in the database takes precedence over the global default. The admin sets it through the Web Admin console, the CLI, or the REST API. Users without an override inherit the global limit.
How the server counts
The quota manager computes a baseline the first time a user uploads: it walks the home directory, sums the sizes of all regular files, and caches the result. From that point on, every write during an upload adds to a per-user delta tracked with an atomic counter. The check - baseline plus delta against the limit - happens on every write, not just when the file is opened. This means the server catches overages mid-transfer rather than after the fact.
Staging files (the .tmp files used during atomic uploads) are stored in a separate staging directory and are not counted toward the quota. Only files that have been successfully committed to the home directory count.
Picking the right mode
Start with soft if you are deploying quotas for the first time. Review the server log for a few weeks to see which users exceed the limit and by how much. Once you are confident the limits are reasonable, switch to hard. The change takes effect on the next upload - no restart required, because quota configuration participates in the server's hot-reload mechanism.
For multi-tenant environments where one user filling the disk affects everyone, hard is the only defensible choice. For internal teams with a shared server where trust is higher, soft with a periodic report may be all you need.