|
CentOS Linux Server Guide |
Reader's Contributions |
||||||||||
Setup Ubuntu 8.04 LTS FTP server with Quota and Bandwidth Management(contributed by Linus Shio)
Package/ Application Required
|
| Note: Sorry, i won’t explain Ubuntu 8.04 LTS JeOS and VMware ESXi server installation (please google). This guide is only command and commands. Yes, as you read thru, i also won’t explain what this command for. Anyway, any Linux immediate users of cause should understand them. |
Step 1. $sudo -s
Step 2. #vim /etc/network/interfaces
| auto eth0 iface eth0 inet static address 192.168.1.2 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 dns-nameservers 202.188.0.133 202.188.1.5 |
Step 3. #vim /etc/hosts
|
127.0.0.1 localhost.localdomain localhost 192.168.1.1 ftp.iampenguin.com ftp |
Step 4. #vim /etc/hostname
|
ftp |
Step 5. #/etc/init.d/hostname.sh start
Step 6. #hostname –fqdn
|
ftp.iampenguin.com |
Step 7. #apt-get update
Step 8. #apt-get dist-upgrade
Step 9. #shutdown –r 0
Step10. #apt-get install build-essential wget cron logrotate rar unrar openssh-server openssl libnet-ssleay-perl mysql-server apache2 php5 php5-gd php5-ming php5-mhash php5-mysql php5-sqlite php5-memcache php5-imap php5-curl php5-idn php-pear php5-imagick php5-mcrypt php5-pspell php5-recode php5-json php5-xsl php5-xmlrpc php5-tidy pure-ftpd-mysql
Step 11. #groupadd –g 2001 ftpgroup
Step 12. #useradd –u 2001 –s /bin/false –d /bin/bull –c “pureftpd user” –g ftpgroup ftpuser
Step 13. #mysql –u root –p
|
mysql> CREATE DATABASE pureftpd; mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost' IDENTIFIED BY 'password'; mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO 'pureftpd'@'localhost.localdomain' IDENTIFIED BY 'password'; mysql> FLUSH PRIVILEGES; mysql> USE pureftpd;
mysql> CREATE TABLE ftpd ( mysql> quit; |
Step 14. #cp /etc/pure-ftpd/db/mysql.conf /etc/pure-ftpd/db/mysql.conf_ori
Step 15. #cat /dev/null > /etc/pure-ftpd/db/mysql.conf
Step 16. #vim /etc/pure-ftpd/db/mysql.conf
| MYSQLSocket /var/run/mysqld/mysqld.sock MYSQLUser pureftpd MYSQLPassword ftpdpass MYSQLDatabase pureftpd MYSQLCrypt md5 MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetUID SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetGID SELECT Gid FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MYSQLGetDir SELECT Dir FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="\L"AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R") |
Step 17. #echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone
Step 18. #echo "yes" > /etc/pure-ftpd/conf/CreateHomeDir
Step 19. #echo "yes" > /etc/pure-ftpd/conf/DontResolve
Step 20. #echo "20" > /etc/pure-ftpd/conf/MaxClientsNumber
Step 21. #echo "5" > /etc/pure-ftpd/conf/MaxClientsPerIP
Step 22. #echo "200 4" > /etc/pure-ftpd/conf/LimitRecursion
Step 23. #echo "133:022" > /etc/pure-ftpd/conf/Umask
Step 24. #echo "yes" > /etc/pure-ftpd/conf/NoAnonymous
Step 25. #echo "no" > /etc/pure-ftpd/conf/DisplayDotFiles
Step 26. #echo "no" > /etc/pure-ftpd/conf/AllowDotFiles
Step 27. #echo “yes” > /etc/pure-ftpd/conf/NoChmod
Step 28. #/etc/init.d/pure-ftpd-mysql restart
Step 29. #cd /
Step 30. #mkdir /packages
Step 31. #cd /packages
Step 32. #wget
http://prdownloads.sourceforge.net/webadmin/webmin-1.490.tar.gz
Step 33. #tar xvzf webmin-1.490.tar.gz
Step 34. #cd webmin-1.490
Step 35. #setup.sh
|
Note:Well, i did setup apache with SSL for phpMyAdmin login page at my customer environment but again, sorry that i won’t explain the configuration. (please google) |
Step 36. #wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/2.11.9.6/phpMyAdmin-2.11.9.6-english.tar.gz
Step 37. #tar xvzf phpMyAdmin-2.11.9.6-english.tar.gz
Step 38. #mv /phpMyAdmin-2.11.9.6 /var/www/phpmyadmin
Step 39. #cd /var/www/phpmyadmin
Step 40. #mkdir config
Step 41. Open browser (eg. IE, Firefox and etc)
Step 42. Type http://192.168.1.1/phpmyadmin/scripts/setup.php
Step 43. #cd config
Step 44. #cp config.ini.php /var/www/phpmyadmin
Step 45. #cd ../
Step 46. #rm –rf config
Step 47. #rm –rf scripts
Step 48. Open browser (eg. IE, Firefox and etc)
Step 49. Type http://192.168.1.1/phpmyadmin and direct to
phpMyAdmin web admin tool. Done.
Step 50. #mysql –u root –p
|
mysql> USE pureftpd; mysql> INSERT INTO `ftpd` (`User`, `status`, `Password`, `Uid`, `Gid`, `Dir`, `ULBandwidth`, `DLBandwidth`, `comment`, `ipaccess`, `QuotaSize`, `QuotaFiles`) VALUES ('ftpuser1', '1', MD5('password'), '2001', '2001', '/home/ftpuser1, '100', '100', '', '*', '100', '1000'); mysql>quit; |
Step 51. #ftp 192.168.1.1
Step 52. User: ftpuser1
Step 53. Password: yourpassword
Step 54. User: The name of the virtual PureFTPd user (e.g.
ftpuser1).
Step 55. status: 0 or 1. 0 means the account is disabled, the user
cannot login.
Step 56. Password: The password of the virtual user. Make sure you
use MySQL's MD5 function to save the password encrypted as an MD5
string.
Step 57. UID: The userid of the ftp user you created at the end of
step two (e.g. 2001).
Step 58. GID: The groupid of the ftp group you created at the end
of step two (e.g. 2001).
Step 59. Dir: The home directory of the virtual PureFTPd user (e.g.
/home/www.example.com). If it does not exist, it will be created when
the new user logs in the first time via FTP. The virtual user will be
jailed into this home directory, i.e., he cannot access other
directories outside his home directory.
Step 60. ULBandwidth: Upload bandwidth of the virtual user in
KB/sec. (kilobytes per second). 0 means unlimited.
Step 61. DLBandwidth: Download bandwidth of the virtual user in
KB/sec. (kilobytes per second). 0 means unlimited.
Step 62. comment: You can enter any comment here (e.g. for your
internal administration) here. Normally you leave this field empty.
Step 63. ipaccess: Enter IP addresses here that are allowed to
connect to this FTP account. * means any IP address is allowed to
connect.
Step 64. QuotaSize: Storage space in MB (not KB, as in ULBandwidth
and DLBandwidth!) the virtual user is allowed to use on the FTP server.
0 means unlimited.
Step 65. QuotaFiles: amount of files the virtual user is allowed to
save on the FTP server. 0 means unlimited.
| Note from
1a-centosserver.com webmaster: Thank you very much for your support to make this comprehensive guide and your kindness to share the knowledge among us. I found this guide if very practical for ftp administration. Since this is using pure-ftpd packages, I will 'migrate' the setting and test out in CentOS Linux soon! |

|
Copyright 2011 http://www.1a-centosserver.com All Rights Reserved All trademarks are the property of their respective owners. Contact Us | Terms of Use | Privacy Policy |