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

Solution 1:

What you need to use is a combo of user_config_dir and local_root. In the main config file /etc/vsftpd/vsftp.conf you have an entry like:

chroot_local_user=YES
user_config_dir=/etc/vsftpd/users

Inside that directory (/etc/vsftpd/users) you have a config file with the same name as the user ($USER in your case), and inside that file you have:

local_root=/var/www/sites/USER
dirlist_enable=YES
download_enable=YES
write_enable=YES

...where USER is the actual name (not literally USER or $USER).

Solution 2:

You must set user_sub_token:

user_sub_token=$USER
local_root=/var/www/sites/$USER