2014年4月9日 星期三

[Linux] Proftp Quota 筆記 @ Ubuntu 12.04

由於採用 Virtual FTP User 的關係,試用一下 Proftp Quota 的服務:

$ cd /etc/proftpd/
$ sudo ftpquota --create-table --type limit
$ sudo ftpquota --create-table --type tally
$ ls -la
ftpquota.limittab
ftpquota.tallytab


$ sudo vim /etc/proftpd/proftpdc.conf
#<IfModule mod_quotatab.c>
#QuotaEngine off
#</IfModule>
$ sudo vim /etc/proftpd/conf.d/QuotaUsage.conf
<IfModule mod_quotatab.c>
QuotaEngine on
QuotaLimitTable file:/etc/proftpd/ftpquota.limittab
QuotaTallyTable file:/etc/proftpd/ftpquota.tallytab
QuotaShowQuotas on
QuotaDisplayUnits Mb
QuotaOptions ScanOnLogin
</IfModule>

$ sudo service proftpd restart


測試:

$ ftp localhost 21
ftp> quote site quota
202 No quotas in effect


試看看限定所有人只能上傳 20GB:

$ sudo ftpquota --table-path /etc/proftpd/ftpquota.limittab --add-record --type limit --quota-type all --units Gb --bytes-upload 20
$ sudo service proftpd restart


$ ftp localhost 21
ftp> quote site quota
200-The current quota for this session are [current/limit]:
200-Name: username
200-Quota Type: User
200-Per Session: False
200-Limit Type: Hard
200-  Uploaded Mb:              0.00/20480.00
200-  Downloaded Mb:    unlimited
200-  Transferred Mb:   unlimited
200-  Uploaded files:   unlimited
200-  Downloaded files: unlimited
200-  Transferred files:        unlimited
200 Please contact root@server if these entries are inaccurate

沒有留言:

張貼留言