Help

Configuring FTP on BitrixVM

Originally, BitrixVM does not provide the ability to connect to the server using the FTP protocol. For file transfer to the server, the secure SFTP protocol is a more preferable option. However, if you need to use FTP (for example, due to specific software requirements), you will need to configure FTP on the server. In this article, we will look at setting up FTP using ProFTPD.

  1. First, connect to the server via SSH and exit the Bitrix menu by pressing "0".
  2. Install ProFTPD:
yum install proftpd
  1. Add ProFTPD to auto-start:
chkconfig proftpd on
  1. Start the service:
service proftpd start
  1. Execute the following command to get the group ID and user ID for the main server user:
id bitrix
  1. You will see an output similar to the following:
uid=600(bitrix) gid=600(bitrix) groups=600(bitrix),10(wheel)
  1. Now create a new user with the same IDs for connection via FTP, specifying the home directory path for the new user, as their access to the server will be restricted to this directory after the -d flag.
adduser username -g600 -o -u600 -d /home/bitrix/www/
  1. Set a password for the new user:
passwd username

Next steps depend on the firewall you are using. CentOS 7, by default, uses firewalld, but some users prefer to use iptables. In older versions of CentOS, iptables is used.

8.1. If you are using firewalld

8.1.1. Add the following rule:

firewall-cmd --add-service=ftp --permanent

8.1.2. Reload firewalld for the changes to take effect:

firewall-cmd --reload

Done. Now try connecting to the server via FTP using the created username.

8.2. If you are using iptables

8.2.1. Open the iptables file:

nano /etc/sysconfig/iptables

8.2.2. Add the following lines below the OUTPUT ACCEPT line:

-A INPUT -p tcp -m tcp --sport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --sport 20 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 20,21,50000:50400 -j ACCEPT

Save changes (press Ctrl+x to exit, then Y to confirm saving, and Enter).

8.2.3. Open the iptables-config file:

nano /etc/sysconfig/iptables-config

8.2.4. Set the following value for the IPTABLES_MODULES parameter:

IPTABLES_MODULES="ip_conntrack_ftp"

Save the changes.

8.2.5. Restart iptables:

service iptables restart

Done. Try connecting to the server via FTP to check.

Have more questions about Hosting?