1 . Open Domains / <Your domain> / Authentication settings page.
2. Create a new Authentication :
- enter name "DB"
- enter account prefix "DB_"
- select method "Database via ODBC"
- enter your connection string (often just "DSN=myDB")
- enter your query, default is : SELECT account FROM ftp_auth WHERE uid=$LOGIN AND password=$PASSWORD
Note: account will be the ftp user account to log the user as, so it has to exist on your ftp domain and has to be returned from your table.
As as consequence your table has at least 3 fields like this :
CODE
login | password | account
Bob | bobpass | ftpuser
Bob | bobpass | ftpuser
3. Create a new ftp account that will be used to log the DB user :
- enter name : "DB_"+"name returned by the database", let's say your database return "ftpuser", you would create "DB_ftpuser" account
- specify access rights to the account : / -> c:\ftproot\
4. Test your setup :
- login as Bob (a user in the db) with password bobpass
- check your domain / logs & reports / default
- the log should report it is trying to use DB_ftpuser and logs the user under this account.
Advanced configuration
If you want to globally use DB authentication for many accounts, you would certainly prefer to only have one ftp account to maintain but you still want to log them in a different folder! Here is how to proceed :
Let's say your table is now :
CODE
login | password | account | ownfolder
Bob | bobpass | ftpuser | c:\ftproot\bob
Tim | timpass | ftpuser | c:\elsewhere\tim
Bob | bobpass | ftpuser | c:\ftproot\bob
Tim | timpass | ftpuser | c:\elsewhere\tim
1. Modify your query to : SELECT account, ownfolder as homedir FROM ftp_auth WHERE uid=$LOGIN AND password=$PASSWORD
If you are using an existent table that does not have the "account" field, you can change to :
CODE
SELECT 'ftpuser' as account, ownfolder as homedir FROM ftp_auth WHERE uid=$LOGIN AND password=$PASSWORD
2. Modify DB_ftpuser account to change the home directory access rights to :
CODE
Virtual path : /
Physical path : $DB(homedir)
Rights: Read, List, Subdir
Physical path : $DB(homedir)
Rights: Read, List, Subdir
What it does is using the "ownfolder as homedir" value returned by the sql query to specify the home directory to use for DB_ftpuser.
3. Bob and Tim can now login, they both use the ftp account DB_ftpuser but have different home folder access.

Help











