Similar VARIABLE for ftp login name.
I am trying this variable in a custom vhost.conf and it works fine.
But what I really need is to use the FTP-LOGIN variable instead of the domain_name variable.
I'm still to try this solution, but it may work fine or so I hope.
Already tested, and it worked fine for me!!!
NOTE: I designed this solution for
apache2-mpm-itk , but I thought it would be applicable too for
mod_ruid2 (just change the added lines in step 3 described below, adapting them to mod_ruid2).
Customizing VHosts templates for running with FTP User
In the aim of customizing vhosts using configuration templates, I've found documentation at the Advanced Administration Guide (v11.0):
http://download1.parallels.com/Ples...nistration-guide/index.htm?fileName=68694.htm
Needed infos for our solution:
- copying parts of the folder /usr/local/psa/admin/conf/templates/default/ to /usr/local/psa/admin/conf/templates/custom/
- editing the file to custom (php format)
- adding the ftp_user and group to be used with the virtual host (using the proper variable for so)
These would be the
complete solution steps:
- Identify those files to customize (Appendix B: Configuration Templates Structure). For our solution would be either of the following:
- /usr/local/psa/admin/conf/templates/default/domainVhost.php (per-website configuration for hosted websites)
- /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php (for hosted website addressed by domain name)
- Copy the specific file to customize preserving the directory structure and field name (here, the purpose of the named 'custom' directory in Plesk is to preserve the original templates, allowing making changes, but not directly to the original files of the default directory):
- # mkdir /usr/local/psa/admin/conf/templates/custom
- # cd /usr/local/psa/admin/conf/templates/default
- # cp --parents domain/domainVirtualHost.php ../custom/
- Edit and make the changes in the php file of the custom directory (/usr/local/psa/admin/conf/templates/custom/domain/domainVirtualHost.php). The variable you were looking for would probably be $VAR-domain->physicalHosting->login . I found it at Appendix C (Apache Configuration Variables) with this description: "username of FTP account used to access the website content; string". Somewhere in the file (e.g. at the line just before: </VirtualHost>) it must be added :
- <IfModule mpm_itk_module>
AssignUserId <?php echo $VAR->domain->physicalHosting->login ?> psacln
</IfModule>
- Check the format of the edited file:
- php -l /usr/local/psa/admin/conf/templates/custom/domain/domainVirtualHost.php
No syntax errors detected in /usr/local/psa/admin/conf/templates/custom/domain/domainVirtualHost.php
- Reconfigure the domain (every reconfigured domain will get the vhost configuration with the added lines):
- # /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain domain.tld
- Check everything is working as desired.
NOTE: this solution assumes that the specific module for running apache under a specific user and group is already installed, though it can be installed after these changes.
Hope that this will help!
Let others know if it worked fine in your case.
EDIT:
This solution has worked fine for me!!
Security Advice: It is important to notice that the group 'psacln' must be this one, and never 'psaserv', since 'psaserv' group has directory execution permissions over /var/www/vhosts/any-domain, and an apache vhost running under this group ('psaserv') could access other users local web files (mainly with read permissions, but enough to stole other users' sensitive data, such as access passwords used by scripts, and developing other direct attacks to those other hosted webpages and services with such stolen sensitive data).