Using an FTP Server for 3CX Backups - Linux

This guide presents the supported FTP solutions available for 3CX Backup and Restore on Linux.

Important Note

The FTP servers tested by 3CX on Linux are vsftpd and Pro-FTPd. An FTP server runs independently of your 3CX PBX and is not required to be installed on the same machine. The FTP server mentioned in this guide is vsftpd.

FTP Server for Linux

This guide describes the installation of the “vsftpd” (very secure file transfer protocol daemon) FTP server on Debian 9/ Debian 10, free for anyone to download and use. To install the “vsftpd” FTP server:

  1. Use an account with administrative privileges to log on to your Linux system via SSH or local terminal.

Update APT Sources on Debian Linux

  1. Update the APT repository information with the command:

sudo apt update

  1. Install
    vsftpd
    with the command:

sudo apt install -y vsftpd

Enable the vsftpd Service to Start on System Boot

  1. Enable the
    vsftpd
    service to start on boot with the command:

sudo systemctl enable vsftpd.service

Configure the vsftpd FTP Service

Edit FTP Server Configuration File

  1. Use the terminal on your Linux server to edit the file
    /etc/vsftpd.conf
    and configure the FTP service, using this command:

sudo nano /etc/vsftpd.conf

  1. These are the minimal configuration options that need to be included in the configuration file for the
    vsftpd
    service to run as intended:

listen=YES

listen_ipv6=NO

anonymous_enable=NO

local_enable=YES

write_enable=YES

local_umask=022

dirmessage_enable=YES

use_localtime=NO

xferlog_enable=YES

xferlog_file=/var/log/vsftpd.log

#Data Connection Timeout control for large file transfer - adjust accordingly.

data_connection_timeout=3600

chroot_local_user=YES

chroot_list_enable=NO

secure_chroot_dir=/var/run/vsftpd/empty

pam_service_name=ftp

allow_writeable_chroot=YES

#pasv_enable=YES

#pasv_max_port=10100

#pasv_min_port=10090

#pasv_address=X.X.X.X

Lines starting with a hash (#) are commented out configuration options and are not applied by “vsftpd” during startup. Configure each option based on your environment and if your FTP server is running behind a NAT device, proceed to step “3”, otherwise skip to step “4”.

  1. If your FTP server is behind a NAT device, you need to enable the use of passive FTP. To do this, uncomment or add these configuration options at the end of the configuration file:

pasv_enable=YES
pasv_max_port=10100
pasv_min_port=10090
pasv_address=X.X.X.X

Configure these passive FTP connection options to suit your network environment:

  • “pasv_min_port” and “pasv_max_port” -  set a different port range (min - max).
  • “pasv_address” - replace the “X.X.X.X” to match your public IP address.
  1. Press
    Ctrl
    +
    X
    , then
    Y
    and
    Enter
    to save the file and exit the editor.
  2. Restart the
    vsftpd
    service to apply the configured options with the command:

sudo systemctl restart vsftpd.service

Add an FTP User to vsftpd

        Commands to Add a User and Set Their Password

  1. Using the Linux terminal, create a new FTP user with the command:

sudo useradd -m -s /bin/nologin 3cxftpuser

In this example we create the FTP user “3cxftpuser” with the “-s /bin/nologin” option to disable shell access for this account, i.e. to be used only for file transfers.

  1. To set a password for the new FTP user, use this command:

sudo passwd 3cxftpuser

  1. Proceed to use the configured FTP service and user for the Backup and Restore function in the 3CX Management Console.

See More

Last Updated

This document was last updated on 2 June 2023

https://www.3cx.com/docs/ftp-server-pbx-backups-linux/ 

Discuss this article