SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Desktop 11
SUSE Linux Enterprise Desktop 10
For various possible reasons, if may be necessary to run 2 or more separate instances of pure-ftpd on one server. For example, a server may have 2 network addresses, both of which must service unique FTP users, but which need to have different FTP configurations or behaviors.
This document discusses one possible way of accomplishing this. There are other methods which could be used, and even this method could (and should) be easily expanded and improved. It is very limited but it is a starting point, and is just offerred "as is."
Keep in mind that in some cases it may not be necessary to have two separate instances of pure-ftpd running, because pure-ftpd can be configured for "virtual servers" which can differentiate between anonymous access to different addresses. However, when requirements necessitate that two separate instances are needed, the method below has shown to be successful.
This procedure will configure the SLES initialization scripts for pure-ftpd to stop and start two instances of pure-ftpd. They will be started and stopped at the same time, not independently of each other. Three or more can be accomplished with the same approach, expanded.
One caution: This method requires customization of the /etc/init.d/pure-ftpd script (which starts and stops pure-ftpd). The application of future updates to the pure-ftpd package might require some extra attention. For example, if the official standard script is changed by the developers, and then an update is done to add that new pure-ftpd package to the system, the install process can recognize that a custom script is in place and not replace it with development's new script. There are obviously pros and cons to this approach. System administrators will need to check for for new scripts inside the new packages, review/compare them for changes, and decide whether to take the new script and re-customize it according to the method below, or keep their old, already-customized script in place.
Steps:
1. Copy /etc/pure-ftpd/pure-ftpd.conf to /etc/pure-ftpd/pure-ftpd2.conf
The name of the new copy can be based on preference. It will be used again later in step 3.
2. Edit both of those conf files and set the unique differences that are required for your needs. Examples:
a. One change that will typically be needed is for each instance of pure-ftpd to bind to a unique address / port combination, rather than try to bind to every local address. To do this, find the "Bind" setting in the conf file and configure it uniquely and appropriately.
b. Another change which some administrators require is to set one instance of FTP to handle "public" FTP requests, when actually the FTP server is completely using private IP addresses, and is behind a NAT firewall. In that case, the configuration file may need to be modified to set "ForcePassiveIP" to show a public address which actually resides on the NAT firewall and is mapped to the FTP instance's private address.
3. Edit /etc/init.d/pure-ftpd
a. Find the "start" section. In particular, focus on 2 lines:
FTPD_ARGS=`/usr/sbin/pure-config-args /etc/pure-ftpd/pure-ftpd.conf`
startproc $FTPD_BIN $FTPD_ARGS
Duplicate these 2 lines, but alter them so a new FTP_ARGS2 variable is set, based on the new conf file from step #1. A new process (second instance) is then started using the new FTP_ARGS2 variable. The new startproc line also needs to ignore the PID file that the first instance of pure-ftpd created. For example, the 2 existing plus 2 new lines would be:
FTPD_ARGS=`/usr/sbin/pure-config-args /etc/pure-ftpd/pure-ftpd.conf`
startproc $FTPD_BIN $FTPD_ARGS
FTPD_ARGS2=`/usr/sbin/pure-config-args /etc/pure-ftpd/pure-ftpd2.conf`
startproc -i /var/run/pure-ftpd.pid $FTPD_BIN $FTPD_ARGS2
(If a 3rd instance was also being used, it would need to ignore the PID file of the first instance as well. Second and third instances will not create additional PID files, in this setup.)
b. Then go to the "stop" section
Find the line:
killproc -G -TERM $FTPD_BIN
Duplicate this so it will kill both instances. In this case, the lines can be exactly the same as each other:
killproc -G -TERM $FTPD_BIN
killproc -G -TERM $FTPD_BIN
4. Upon rebooting, both should come up. Or to put this into effect without rebooting, execute:
rcpure-ftpd stop
rcpure-ftpd start
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.