Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
add comment

2 Answers

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
anonymous_enable=NO
local_enable=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
write_enable=YES

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
add comment

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
add comment

Your Answer

 
discard

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.