ftp

How to Edit FTP Server Configuration from the Command Line

Last modified: August 12, 2024


Overview

This document explains how to manually edit the FTP server’s configuration from the command line.

Note:

For more ways to configure your FTP server, read our FTP Server Configuration documentation.

Determine your FTP server

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

grep ftpserver /var/cpanel/cpanel.config

You will receive one of the following two results:

1
2
ftpserver=proftpd
ftpserver=pure-ftpd

Follow the instructions that correspond to your FTP server type.

ProFTP configuration

To edit the FTP configuration for ProFTP, perform the following steps:

  1. Use your preferred text editor to create or edit the /var/cpanel/conf/proftpd/local file.
  2. Enter your changes in the local file.
  3. To apply your changes, perform a force update of FTP with the following command:
    /scripts/setupftpserver proftpd --force

ProFTP configuration with managed_settings

The /usr/local/cpanel/Cpanel/FtpUtils/Config/Proftpd.pm file contains managed_settings options for ProFTP users.

You may configure the following managed_settings options in the root user’s /usr/local/cpanel/Cpanel/FtpUtils/Config/Proftpd.pm files from the command line:

  • Options that correspond to the settings in WHM’s FTP Server Configuration interface (WHM » Home » Service Configuration » FTP Server Configuration).
    Note:

    The FTP Server Configuration interface only appears if you enable FTP on your WHM server.

  • Options that manage Network Address Translation (NAT).

To print this file’s contents to your command line, log into your server via SSH as the root user and run the following command with the appropriate file name:

cat filename

In the file, the list of managed_settings options will appear in the new subroutine. For example, a portion of your file may resemble the following sample, where MaxInstances is the configurable option:

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

To apply your changes, then perform a force update of FTP with the following command:

/scripts/setupftpserver proftpd --force

Pure-FTP configuration

To edit the FTP configuration for Pure-FTP, perform the following steps:

  1. Use your preferred text editor to create or edit the /var/cpanel/conf/pureftpd/local file.
  2. Enter your changes in the local file. For example, to set the ForcePassiveIP setting to the IP address, enter the following in the local file:
    ForcePassiveIP: 203.0.113.0
    • To clear that value, change the local file to use the following setting:
      ForcePassiveIP: ~
  3. To apply your changes, perform a force update of FTP with the following command:
    /scripts/setupftpserver pure-ftpd --force

Additional Documentation