設定Pure ftp Virtual Quota

針對個別使用者設定:
在建立新使用者或修改使用者參數是,皆可定義quota值.
-n 設定檔案數
-N 設定容量大小(Mb)
建立新使用者
pure-pw useradd testuser -u ftpuser -d /home/web/testuser -n 1000 -N 20 -m
修改使用者
pure-pw usermod testuser -n 1000 -N 20 -m
From:ADJ 網路實驗室

用上面二個方式設定完可用
pure-pw show testuser
來確定是否設定完成.
在下測試時,用pure-pw show 去看,發現Max files及Max size都己經有改了,但是用ftp cliet測試時quota無效,後來發現參數-m很重要,一定要下,它會同時update /etc/pureftpd.pdb database,這樣quota才有做用.
然後用ftp client登入時,會自行建立.ftpquota檔,對home directory的檔案及容量所做的變動會紀錄在這個檔裡,檔案內容的左邊數字是檔案數量,右邊是容量大小,pure-ftp也是靠這個檔來判斷是否在quota範圍內.
但無論如何,自行建立的這檔是空的,也就是不管裡用了多少空間,多少檔案,它都由0開始計算,所以可以用 pure-quotacheck 這個指令,來產生正確的 .ftpquota 檔.
pure-quotacheck -u ftpuser -d /home/web/testuser
此時可以在用ftp client試試quota是否生效了! ^^
整體設定:
vi /etc/pure-ftpd.conf

# Enable virtual quotas. The first number is the max number of files.
# The second number is the max size of megabytes.
# So 1000:10 limits every user to 1000 files and 10 Mb.
Quota 1000:20
之後
service pure-ftpd restart
用ftp client登入時,一樣也會建立 .ftpquota 檔,而 .ftpqutoa 須注意的部份,也和上述相同.
備註:
若針對個別使用者設定,則quota以個別使用者為準,另外關於整體部份的設定,檔案數及容量大小皆要下才行,但在下只想限制使用容量大小,若也朋友知道的,也請指點一下小弟.

Please follow and like us:

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *