Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Alright, I'm trying to replicate a web hosting company's basic setup here by authenticating virtual users via SQL and redirect/jail them to their directory. I've accomplished most of the goals here, with the exception of redirect/jailing them to their directory.

The directories are stored in /home/ftp and that's what DefaultRoot is set to. I want each individual user to have and be jailed into their own directory. It doesn't appear that setting homedir in SQL has any effect. Upon logging into FTP with any user, it logs into the DefaultRoot with no directory jailing or redirect.

How do I accomplish this last task?

share|improve this question
up vote 4 down vote accepted

Try commenting out DefaultRoot I think it may override the values read from the database backend.


If DefaultRoot is set and anything other than ~ then the user will be jailed in a tree rooted at DefaultRoot.

If DefaultRoot is ~ then the user will be jailed in a tree rooted at theit home directory.

share|improve this answer
But this action invalidates the task of jailing the user to their directory, which is a step towards information security. – Nik Jun 7 '10 at 16:14
set DefaultRoot to ~ this makes the server use the users home directory wherever it comes from. – Iain Jun 7 '10 at 17:15
+1 Agreed this works. – Richard Holloway Jun 7 '10 at 22:29

In addition to setting DefaultRoot ~ as mentioned, what does your SQL config look like - are you actually extracting it from the database?

DefaultRoot ~

<IfModule mod_dso.c>
  LoadModule mod_sql.c
  LoadModule mod_sql_mysql.c

SQLLogFile          /var/log/proftpd/mod_sql.log
PersistentPasswd    off
AuthPAM             off
AuthUserFile        /some/path/to/dummy/passwd.ftp
AuthGroupFile       /some/path/to/dummy/group.ftp
AuthOrder           mod_sql.c mod_auth_file.c

SQLConnectInfo      proftpd@localhost:3306 userdatabase password
SQLAuthTypes        Backend Crypt Plaintext OpenSSL
SQLUserInfo         user user_id password NULL NULL ftp_homedir NULL
SQLAuthenticate     users
SQLDefaultUID       14
SQLDefaultGID       50
SQLMinUserUID       13
SQLMinUserGID       49

That's a more or less concise example of doing 100% auth from the database and jailing them to their homedir as listed in the DB. If you want to also dynamically create their home directory when they log in (useful if you add them in a database and don't want to log into a server to do it) you can add:

CreateHome on dirmode 0755 the config. The other two dummy files listed above match your ProFTPd install, which on a Red Hat/Centos server:


ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin



This all makes your virtual users have UID/GID of 14:50 on the hard drive regardless of their login username.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.