نحوه ویرایش تنظیمات سرور FTP از طریق خط فرمان

این مقاله نحوه ویرایش دستی تنظیمات سرور FTP از طریق خط فرمان را توضیح می‌دهد، روش تشخیص نوع سرویس FTP فعال را بیان می‌کند و مراحل اعمال تغییرات برای ProFTP و Pure-FTP را آموزش می‌دهد. همچنین نحوه استفاده از گزینه‌های managed_settings و اجرای به‌روزرسانی اجباری برای اعمال تنظیمات جدید شرح داده شده است.

FTP ConfigurationProFTPPure-FTP

~3 دقیقه مطالعه • بروزرسانی ۲۹ بهمن ۱۴۰۴

1. Overview


This guide explains how to manually edit your server’s FTP configuration using the command line. These steps allow administrators to customize behavior for ProFTP or Pure-FTP depending on which service is installed.


Note: For additional configuration methods, refer to the FTP Server Configuration documentation in WHM.


2. Determine Your FTP Server


To identify which FTP server your system uses, log in via SSH as the root user and run the following command:


grep ftpserver /var/cpanel/cpanel.config

You will receive one of the following results:


  • ftpserver=proftpd
  • ftpserver=pure-ftpd

Follow the configuration instructions that match your server type.


3. ProFTP Configuration


To edit the configuration for ProFTP, follow these steps:


  1. Create or edit the /var/cpanel/conf/proftpd/local file using your preferred text editor.
  2. Add your configuration changes to the file.
  3. Apply the changes by running the following command:

/scripts/setupftpserver proftpd --force

4. ProFTP Configuration with managed_settings


The file /usr/local/cpanel/Cpanel/FtpUtils/Config/Proftpd.pm contains managed_settings options that can be configured from the command line.


You may configure:


  • Options corresponding to WHM’s FTP Server Configuration interface.
  • Options related to Network Address Translation (NAT).

To print the contents of the file, run:


cat /usr/local/cpanel/Cpanel/FtpUtils/Config/Proftpd.pm

Inside the file, the managed_settings list appears in the new subroutine. For example:


sub new {
    my $class = shift;
    my $self  = $class->SUPER::_init();
    $self->{'managed_settings'} = {
        'maxinstances' => {
            'name'    => 'MaxInstances',
            'context' => { 'server' => 2, },
            'default' => 'none',
}

After making changes, apply them using:


/scripts/setupftpserver proftpd --force

5. Pure-FTP Configuration


To edit the configuration for Pure-FTP, follow these steps:


  1. Create or edit the /var/cpanel/conf/pureftpd/local file.
  2. Add your desired configuration. For example, to set the ForcePassiveIP value:

ForcePassiveIP: 203.0.113.0

To clear the value, use:


ForcePassiveIP: ~

Apply the changes with:


/scripts/setupftpserver pure-ftpd --force

6. Conclusion


Editing FTP server configuration from the command line provides full control over how ProFTP and Pure-FTP operate on your server. By modifying local configuration files and applying updates with force rebuild commands, administrators can fine-tune performance, security, and network behavior.


نوشته و پژوهش شده توسط دکتر شاهین صیامی