Here are the steps you should take to set this up:
VSFTPd
Create the /etc/vsftd.conf file
#nano /etc/vsftpd.conf
listen=YES
anonymous_enable=NO
local_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/vsftpd.pem
download_enable=yes
guest_enable=NO
write_enable=yes
#If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot()
chroot_local_user=no
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
Next create your chroot list to keep users from browsing outside of their home directory
#nano /etc/vsftpd.chroot_list
someusernamehere
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):
#nano /etc/ssh/sshd_config
AllowUsers username1 username2
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:
#nano /etc/fstab
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:
/dev/hda1 /home ext2 defaults,usrquota 1 1
or
# /home was on /dev/sda3 during installation
UUID=fce47086-925c-4164-80a4-4ba6b307123b /home ext4 defaults,usrquota 0 2
or
# /home was on /dev/sda3 during installation
UUID=fce47086-925c-4164-80a4-4ba6b307123b /home ext4 defaults,usrquota,grpquota 0 2
You can remount by rebooting or using the following example:
#mount -o remount,usrquota /home
Check your mounts:
#mount | grep quota
Load the quota kernel module:
#modprobe quota_v2 echo 'quota_v2' >> /etc/modules
Setting up you Quotas
Install the quota package.
#apt-get install quota quotatool
Create the following files if they do not already exist. These files store your quota limits:
#touch /home/aquota.user
#touch /home/aquota.group
#chmod 600 /home/aquota.user /home/aquota.group
turn on quatacheck without rebooting:
# quotacheck -vagum
If your kernel supports journaled quota but you are not using it you’ll probably get an error. Use this command in that case:
# quotacheck -fvagum
Set limits for user:
#quotatool -u someusername -bq 100M -l '200 Mb' /home
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:
#repquota /home
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.