We currently have a LAMP stack for shared webhosting, and are using ProFTP with that.
Currently the ProFTP config is fairly stock - users are chrooted to ~. Currently running as the default user/group. We only use system users - no virtual users.
We use SuPHP to run each PHP process as the appropriate user/group.
What I'd really like is to have ProFTP automatically set the user:group of uploaded files to whomever is logged in. So if I login to FTP as "customer-a", I'd like any uploaded files be owned by "customer-a".
The main reason for this is, it seems, if I login as someone right now, they don't have permission to write to their home directory. Instead of loosening permissions, I'd like ProFTP to switch the user context appropriately.
Possible Solutions
One thing I've considered is perhaps declaring a virtual-host for each customer domain, which would then allow me to configure the User and Group directives individually.
1) This is a pain to do, I'd rather avoid having to append config for each user created. 2) ProFTP doesn't seem to support name-based virtual hosts.
Alternatively, I could make use of the UserOwner and GroupOwner directives, and create a new <Directory> block for each customer in the config.
I imagine something like this might work:
<Directory /home/customer-a/>
UserOwner customer-a
UserGroup customer-a
</Directory>
But it would be nice to be able to do this in a more general fashion, similar to the %u variable, documented here. But I don't think that will work with UserOwner.
Some details
- Using Ubuntu
- ProFTP 1.3.4a
- Apache 2.2
- Using SuPHP with PHP-CGI.