Creating FTP Accounts on ZFS space with quotas

As part of the Gconnect 30:30 server product, I need to create a 10GB FTP store for each server. Its part of the deal so customers can use it either for backup, if they don’t want the server image backups or for just storing some transient data on. I’m using ZFS storage for the FTP space so utilising ZFS’s quota feature will work well.

Create a file system for the user:

zfs create DATA/CUSTOMER_NAME

Now create a quota

zfs set quota=10G DATA/CUSTOMER_NAME

The system will create a directory structure to match this so when I ‘df -h’, I get:

Filesystem                        Size    Used   Avail Capacity  Mounted on
/dev/mfid1p2                      269G    7.1G    241G     3%    /
devfs                             1.0k    1.0k      0B   100%    /dev
DATA                              7.1T     36G    7.1T     0%    /DATA
DATA/CUSTOMER_NAME                 10G     37k     10G     0%    /DATA/CUSTOMER_NAME

Note that i had an existing DATA ZFS filesystem already set up and want the customer space to sit underneath it. Now when you create the FTP user, the home directory can point to the new folder. Don’t forget to ftpchroot the user to prevent them wandering round the filesystems.

This entry was posted in FreeBSD Administration

原文链接:,转发请注明来源!

发表评论