Virtual Hosting With vsftpd And MySQL On Debian Lenny - Page 2

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Mon, 2010-03-08 17:38. ::

5 Create The First Virtual User

To populate the database you can use the MySQL shell:

mysql -u root -p

USE vsftpd;

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'));
quit;

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:

mkdir /home/vsftpd/testuser
chown vsftpd:nogroup /home/vsftpd/testuser

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.

 

7 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Pawel (not registered) on Mon, 2012-02-13 17:41.

Hi,

I went through all of your steps given at "Virtual Hosting With vsftpd And MySQL On Debian Lenny" and the vsftpd-based server doesn't work. What could went wrong if your instructions were followed?

Thanks,

Pawel.