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

Ideally I'd like something like proftpds ability to do this

DefaultRoot /var/www/whatever/userone/ user1
DefaultRoot /home/directory/whatever/ user2

It's important that this be for virtual users.

share|improve this question
up vote 1 down vote accepted

Yes, it's possible, see my post here:

vsftpd - local_root=/var/www/sites/$USER doesn't get interpreted?

You need to use the per-user config files in order to specify a unique chroot location for them. In your case the per-user config "local_root" will be varying values outside of /var/www/sites/ as required.

share|improve this answer

This can be done very easily with PAM.

If your disto doesn't come with PAM, then you'll need to grab a copy, as vsftpd uses PAM for authentication of virtual users.

There is a debian package for pam_pwdfile already available, alternatively, download and compile it, if your copy of linux doesn't come with it already:

apt-get install libpam-pwdfile

First, create a password file for the first user:

htpasswd -c /etc/vsftpd/passwd user1

And then:

htpasswd /etc/vsftpd/passwd user2

Next you need to edit the vsftpd configuration file /etc/vsftpd.conf


Finally you need to configure PAM to use the password file, so edit /etc/pam.d/vsftpd

# Customized login using htpasswd file
auth    required pwdfile /etc/vsftpd/passwd
account required

Don't forget to restart vsftpd, and that's pretty much it!

share|improve this answer
Cheers, but I know to setup virtual users and structured chroots. I was wondering if each user could have a complete different chroot, something outside /var/www/sites/ in your example. – RecQuery Jan 26 '11 at 8:36

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.