Gene6 FTP Server Forum: DB authentication - Gene6 FTP Server Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

DB authentication External authentication using login, password stored in a database Rate Topic: -----

#1 User is offline   Matthieu 

  • Addicted Member
  • Group: Staff
  • Posts: 1964
  • Joined: 22-October 03
  • Gender:Male
  • Location:France : Mouy
  • Interests:Science-fiction, World news

Posted 13 April 2006 - 10:35 AM

Simple configuration

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


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


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


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.
Gene6, SARL
Do not use PM to ask for support, use the forum or support email.

Special offer : 10% discount with coupon code : DISCOUNT
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users