VSFTPD – Virtual Users Home Directories with PAM-MySQL

ftplinuxpamUbuntuvsftpd

I've seen many solutions like homedir=/somepath/$USER where $USER takes from sysvar
and I want to change it for every user with mysql database. I'm using it with pam-mysql so it will look like

Id login passwd homedirectory

And I want this home directory to put in vsftpd.conf->home_directory = something like

 select homedirectory from vsftpd where login='$USER'

Is it possible?

Best Answer

Crap, it's so silly and this works...

local_root=``mysql -sN -utestuser -ptestpass -h localhost DB_NAME -e "select homedir from vsftpd.users where userid = '$user'"``