I tried to configure user disk quotas for vsftpd.
I configured quotas for ftp virtual users using the "quota" package on debian (you know, by editing /etc/fstab and all that stuff). Internet told me that it's the only solution with vsftpd.
The problem is : when a file is uploaded on the ftp server, its ownser is ftp:nogroup, so the quota doesn't apply to my user, for example bob:bob.
I also tried to chown ftp:bob the target folder, and use group quota on bob group, but I didn't work
So I went straight to the FAQ and didn't find this 🙂 Do you have any solution on this quota problem ?
Cheers,
Mehdi
Best Answer
Here are the steps you should take to set this up:
VSFTPd
Create the /etc/vsftd.conf file
Next create your chroot list to keep users from browsing outside of their home directory
SSH
Now since this user has a real account on the system (disk quotas don't work on virual users), you should update SSH if it’s running. Add the following at the bottom line and make sure that the user above is not listed (ie only list users you want to access the server via SSH):
Preparing Mount Points
Will will now install and enable quotas
This shows how to do this per user and per group. By the way, quota support is enabled as the file systems are mounted so you’ll need to reboot your server when you complete the following steps. Please don’t do the on a remote machine unless you know exactly what you’re doing.
Perform the following as root or use sudo:
You need to have the following in your fstab file (usrquota or grpquota). Here are some examples depending on how you installed your ubuntu server:
or
or
You can remount by rebooting or using the following example:
Check your mounts:
Load the quota kernel module:
Setting up you Quotas
Install the quota package.
Create the following files if they do not already exist. These files store your quota limits:
turn on quatacheck without rebooting:
If your kernel supports journaled quota but you are not using it you’ll probably get an error. Use this command in that case:
Set limits for user:
The first value is a soft limit, the second is a hard limit. Note that if a user attempts to load a 100Mb text file and they are already over their softlimit by 20Mb, their text file will be truncated by 20Mb to keep them under the 200Mb hard limit.
Check quotas:
If ever you wish to remove a quota for a user simply set their hard and soft limits to '0'.
I know it's a lot but that should do it! I ran through the process from scratch before publishing this just to be sure.