Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I want to control my ProFTPd authentication by a MySQL database. Users will be able to change the username and password of their FTP account(s) in a PHP web application. This provokes a following problem: The users set in the database usertable do not match the system users. So I am not able to change the directory permissions in my filesystem and ProFTPd logs the error:

username chdir("/var/www/vhosts/sites/username"): Permission denied

But how could I give these FTP users access to these folders? If I set up a user called www-data it works fine but the usernames will not be defined in /etc/passwd.

The second thing I want to manage is the restriction of this only directory, in this case /var/www/vhosts/sites/username. The user mustn't have access to other directories if they are not in the home directory above.

How do I fix this?

share|improve this question
Are you saying that you want to use MySQL for authentication, yet you still want to set permissions on directories as if they were system users? – Kvisle Oct 29 '11 at 13:04
up vote 3 down vote accepted

You will have to give your proftpd virtual users ownership of their files and directories just like you would a real user. You can do this with chown. As the users aren't system users you will have to use the numeric UID:GID e.g. if username is UID 10001 and GID 1111 (from the mysql database) then

chown  10001:1111 /var/www/vhosts/sites/username
chown  -R 10001:1111 /var/www/vhosts/sites/username

should give username control over their own files. Ensure that www-data user has suitable read only access to the file & directories e.g. give world r-x to directories and r-- to files.

If you set the

DefaultRoot  ~

directive then the users will be confined within their own directory tree.

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.