Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 setup a www-data user for vsftpd and set its root dir to /somepath/www-data/project.

How can I do this?

share|improve this question
up vote 0 down vote accepted

The vsftpd man page is here. Also check out the example directory showing different possible FTP configurations.

Real users

Assuming you want a real system user to access ftp, you will have to set the option local_enable=Yes. But if you do that, all your users will automatically be able to log in via FTP. Therefore it might be a good idea to setup a whitelist of FTP users by setting userlist_enable=Yes, userlist_deny=No and specifying 'userlist_file'. If you wish to lock users in their home directories, you can set chroot_local_user=Yes

minimal sample /etc/vsftpd.conf:

# Access rights

Virtual Users

Vsftpd also supports virtual users via PAM integration. Set guest_enable=Yes in /etc/vsftpd.conf. This has the effect of mapping every non-anonymous successful login to the local username specified in 'guest_username'. Then, use PAM and (e.g.) its pam_userdb module to provide authentication against an external (i.e. non-/etc/passwd) repository of users. I've never personally used this configuration, but there are examples of virtual users setups in the example directory.

share|improve this answer

First log in as root: sudo -i.
Then to add a user: useradd -d /somepath/www-data/project -m user

That user should then be able to log in.

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.