Virtual Hosting With vsftpd And MySQL On Debian Lenny - Page 2
5 Create The First Virtual User
To populate the database you can use the MySQL shell:
mysql -u root -p
Now we create the virtual user testuser with the password secret (which will be stored encrypted using MySQL's PASSWORD function):
INSERT INTO accounts (username, pass) VALUES('testuser', PASSWORD('secret'));
testuser's homedir is /home/vsftpd/testuser; unfortunately vsftpd doesn't create that directory automatically if it doesn't exist. Therefore we create it manually now and make it owned by the vsftpd user and the nogroup group:
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 testuser, and the password is secret.
If you are able to connect - congratulations! If not, something went wrong.
6 Database Administration
For 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 vsftpd database.
Whenever you create or modify a user, make sure that you use MySQL's PASSWORD function to encrypt that user's password. Also, when you create a new virtual user, please don't forget to create that user's homedir on the shell, as shown at the end of the previous chapter.