VMware Images:
|
Virtual Hosting With Proftpd And MySQL (Incl. Quota) On Ubuntu 8.04 LTS - Page 2
6 Populate The Database And TestTo populate the database you can use the MySQL shell: mysql -u root -p USE ftp; First we create an entry in the table ftpgroup. It contains the groupname, the groupid and the username of the ftp group/user we created at the end of step two (replace the groupid appropriately if you use another one than 2001): INSERT INTO `ftpgroup` (`groupname`, `gid`, `members`) VALUES ('ftpgroup', 2001, 'ftpuser'); Now we are done with the table ftpgroup. We do not have to create further entries here. Whenever you create a new virtual ftp user, you do this in the tables ftpquotalimits and ftpuser. So let us create our first user exampleuser with a quota of 15MB and the password secret (we are still in the MySQL shell): INSERT INTO `ftpquotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES ('exampleuser', 'user', 'true', 'hard', 15728640, 0, 0, 0, 0, 0); INSERT INTO `ftpuser` (`id`, `userid`, `passwd`, `uid`, `gid`, `homedir`, `shell`, `count`, `accessed`, `modified`) VALUES (1, 'exampleuser', 'secret', 2001, 2001, '/home/www.example.com', '/sbin/nologin', 0, '', ''); quit; (Do not forget to replace the groud- and userid 2001 appropriately in the last INSERT statement if you are using other values than in this tutorial!) Now open your FTP client program on your work station (something like WS_FTP or SmartFTP if you are on a Windows system or gFTP on a Linux desktop) and try to connect. As hostname you use server1.example.com (or the IP address of the system), the username is exampleuser, and the password is secret. If you are able to connect - congratulations! If not, something went wrong. Now, if you run ls -l /home/ you should see that the directory /home/www.example.com (exampleuser's home directory) has been automatically created, and it is owned by ftpuser and ftpgroup (the user/group we created at the end of step two): root@server1:~# ls -l /home/
7 Database AdministrationFor most people it is easier if they have a graphical front-end to MySQL; therefore you can also use phpMyAdmin (in this example under http://server1.example.com/phpmyadmin/) to administrate the ftp database. Whenever you create a new user, you only have to create entries in the tables ftpquotalimits and ftpuser so I will explain the columns of these tables here: ftpuser Table:The important columns are these (the others are handled by MySQL or Proftpd automatically, so do not fill these manually!):
ftpquotalimits Table:The important columns are these (the others are handled by MySQL or Proftpd automatically, so do not fill these manually!):
The ftpquotatallies table is used by Proftpd internally to manage quotas so you do not have to make entries there!
8 Anonymous FTPIf you want to create an anonymous ftp account (an ftp account that everybody can login to without a password), you can do it like this: First we create a user and group with the name anonymous_ftp. The user has the home directory /home/anonymous_ftp: groupadd -g 2002 anonymous_ftp (Replace 2002 with a group-/userid that is free on your system.) Then we create the directory /home/anonymous_ftp/incoming which will allow anonymous users to upload files: mkdir /home/anonymous_ftp/incoming And finally, open /etc/proftpd/proftpd.conf and append the following directives to it: vi /etc/proftpd/proftpd.conf
Finally restart Proftpd: /etc/init.d/proftpd restart Now anonymous users can login, and they can download files from /home/anonymous_ftp, but uploads are limited to /home/anonymous_ftp/incoming (and once a file is uploaded into /home/anonymous_ftp/incoming, it cannot be read nor downloaded from there; the server admin has to move it into /home/anonymous_ftp first to make it available to others). (Please note: You can only have one anonymous ftp account per IP address!)
9 ReferencesMandrake 10.1 - Proftpd + MySQL authentication + Quotas Howto: http://www.khoosys.net/single.htm?ipg=848
10 Links
|





print: 
Recent comments
7 hours 14 sec ago
7 hours 52 min ago
8 hours 18 min ago
10 hours 36 min ago
10 hours 56 min ago
11 hours 25 min ago
12 hours 18 min ago
14 hours 40 min ago
14 hours 57 min ago
15 hours 28 min ago