I run a linux server with Apache + SUexec where all virtualhosts htdocs folder are owed by specific users :
# ls /www/sites drwxr-xr-x 4 vhost-sitea.com vhost-sitea.com 4096 Oct 13 16:45 www.sitea.com/ drwxr-xr-x 3 vhost-siteb.com vhost-siteb.com 4096 May 14 20:09 www.siteb.com/ drwxr-xr-x 5 vhost-sitec.com vhost-citec.com 4096 Nov 22 2013 www.sitec.com drwxr-xr-x 3 vhost-sited.com vhost-sited.com 4096 Oct 25 2014 www.sited.com/
I want the owners of these websites to be able to connect through VSFTPD and manage their own folders. For that, each virtual user is named "user_a", "user_b"( ... ) based on its website.
My VSFTPD configuration, based on Chroot and Virtual users, is the following:
# cat /etc/vsftpd.conf listen=YES anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 nopriv_user=vsftpd virtual_use_local_privs=YES guest_enable=YES user_sub_token=$USER local_root=/home/vsftpd/users/$USER # Overridden by user_config_dir below chroot_local_user=YES guest_username=vsftpd user_config_dir=/etc/vsftpd/vsftpd_user_conf
and the user configuration file is (example with "user_a" for website "www.sitea.com") :
# cat /etc/vsftpd/vsftpd_user_conf/user_a local_root=/www/sites/www.sitea.com write_enable=YES
Now my issue is, when this user tries to upload a file, VSFTPD uses the "vsftpd" unix user, which fails because the www.sitea.com folder and subfolders are owned by specific "vhost-sitea.com" user (as per SUexec configuration).
You have to understand that under SUexec, Apache "www-data" user is not used at all regarding www virtual folder rights so I cannot simply use it in "guest_username" directive.
Is there a way to specify a VSFTP daemon user for each virtual user that logs in, so that the VSFTPd daemon will write files under "vhost-sitea.com" user, when the virtual "user_a" user is connected with VSftp ?
Thank you for your help, Ken.