home_dir). Therefore, ensure a unique home_dir is assigned to each bucket and user.delete_enable option can be configured for each FTP user in the new FTP Server to identify whether the FTP user is allowed to delete files.
Supported FTP commands:put, mput, get, rename, delete, mkdir, ls, cd, bye, quite, and size.
Unsupported FTP commands:append and mget (The native mget command is not supported, but batch download is allowed on certain Windows clients, such as the FileZilla client.)yum install python-devel or aptitude install python-dev.setup.py to install FTP Server and its dependent libraries (network required).python setup.py install # Your account should use sudo or have the root permission.
conf/vsftpd.conf.example and name it conf/vsftpd.conf. See Configuration File of this document to correctly configure bucket and user information.ftp_server.py to start FTP Server.python ftp_server.py
nohup command to start it in the backend process:nohup python ftp_server.py >> /dev/null 2>&1 &
screen command to run it at the backend (you need to install the screen tool):screen -dmS ftpscreen -r ftppython ftp_server.py#Use the keyboard shortcut Ctrl + A + D to go back to the main screen.
screen command, you can stop it with the shortcut key combination Ctrl+C. nohup command, you can stop it by the following way:ps -ef | grep python | grep ftp_server.py | grep -v grep | awk '{print $2}' | xargs -I{} kill {}
conf/vsftpd.conf.example. Copy and name it vsftpd.conf, and then configure it as follows:[COS_ACCOUNT_0]cos_secretid = COS_SECRETID # Replaced with your SECRETIDcos_secretkey = COS_SECRETKEY # Replaced with your SECRETKEYcos_bucket = examplebucket-1250000000cos_region = region # Replaced with your bucket regioncos_protocol = https#cos_endpoint = region.myqcloud.comhome_dir = /home/user0 # Replaced with the local path you want the FTP to mount to (which should be an actual existing path but not a soft link)ftp_login_user_name=user0 # Replaced with a custom usernameftp_login_user_password=pass0 # Replaced with a custom passwordauthority=RW # The user’s read and write permissions. R: read; W: write; RW: both.delete_enable=true # true allows the FTP user to delete files by default; false prohibits the user to delete files.[COS_ACCOUNT_1]cos_secretid = COS_SECRETID # Replaced with your SECRETIDcos_secretkey = COS_SECRETKEY # Replaced with your SECRETKEYcos_bucket = examplebucket-1250000000cos_region = region # Replaced with your bucket regioncos_protocol = https#cos_endpoint = region.myqcloud.comhome_dir = /home/user1 # Replaced with the local path you want the FTP to mount to (which should be an existing path but not a soft link)ftp_login_user_name=user1 # Replaced with a custom usernameftp_login_user_password=pass1 #Replaced with a custom passwordauthority=RW # The user’s read and write permissions. R: read; W: write; RW: both.delete_enable=false # true allows the FTP user to delete files by default; false prohibits the user to delete files.[NETWORK]# If the FTP Server is behind a gateway or NAT, you can use this section to specify the gateway's IP address or domain name as the FTP Server’s IP address.masquerade_address = XXX.XXX.XXX.XXX# The listening port for FTP Server is 2121 by default. Please note that your WAF needs to ALLOW this port (for example, if you deploy FTP Server on a Tencent Cloud CVM, you need to ALLOW this port in your CVM security group.)listen_port = 2121# `passive_port` sets the available port range in Passive mode, with a default of [60000, 65535]. Note that your WAF (such as CVM security group) needs to ALLOW this range.passive_port = 60000,65535[FILE_OPTION]# By default, the maximum size of a single file is 200 G. We do not recommend going beyond the limit.single_file_max_size = 21474836480[OPTIONAL]# For the following settings, take the default settings unless otherwise needed. Fill in an appropriate integer if necessary.min_part_size = defaultupload_thread_num = defaultmax_connection_num = 512max_list_file = 10000 # The maximum number of files to be listed by `ls` command. It is not recommended to go beyond this limit. Otherwise, high latency of `ls` command will occur.log_level = INFO # Set the log output level.log_dir = log # Set the directory to store logs. Default: `log` under the `FTP Server` directory.
[COS_ACCOUNT_X] section.
The section for each COS_ACCOUNT_X is described as follows:ftp_login_user_name) and the home directory (home_dir) under each account must be unique, and the home directory must be a directory that exists in the system.endpoint and region will not take effect at the same time. To use the public cloud COS service, enter the region field correctly. The endpoint is commonly used in the privatized deployment environment. When both 'region and endpoint are entered, endpoint` will take precedence.masquerade_address section in your configuration file, we recommend you specify the IP address that your client is using to connect to the COS FTP Server. If you have any questions, please see the FAQs about FTP Server.ifconfig command, you get a private ENI IP 10.xxx.xxx.xxx, which is mapped to the public IP 119.xxx.xxx.xxx. At this time, if the FTP Server does not explicitly set masquerade_address to the public IP (119.xxx.xxx.xxx) that the client uses to access the server, the FTP Server in Passive mode may use the private IP (10.xxx.xxx.xxx) to return packets to the client. As a result, the client is able to connect to the FTP Server, but cannot return data packets to the client properly. Therefore, generally speaking, we recommend you to set masquerade_address to the IP address that your client is using to connect to the Server.listen_port sets the listening port for the COS FTP Server, and is defaulted to 2121. passive_port sets the range of data channel listening ports for the COS FTP Server, and is defaulted to [60000, 65535]. When your client connects to the COS FTP Server, ensure that your WAF allows the ports configured in these two sections.ftp commandyum install -y ftp
ftp [ip address] [port No.] to connect to the COS FTP Server. Example:ftp 192.xxx.xx.103 2121
ftp command, the IP field corresponds to the masquerade_address section in the sample configuration file conf/vsftpd.conf.example. In this example, the IP is set to 192.xxx.xx.103.ftp command, the port field corresponds to the listen_port section in the sample configuration file conf/vsftpd.conf.example. In this example, the port is set to 2121.ftp_login_user_name and ftp_login_user_passwordthe sections for COS FTP Server, and the connection will succeed.conf/vsftpd.conf.example.conf/vsftpd.conf.example.conf/vsftpd.conf.example. In this example, the IP is set to 192.xxx.xx.103.conf/vsftpd.conf.example.conf/vsftpd.conf.example.conf/vsftpd.conf.example. In this example, the port is set to 2121.Feedback