FTP server set up under the cloud Ali

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/LZPRO/article/details/89031606

Recent Hikvision camera, you need to use FTP function, you just set up an FTP server

Server: Ali cloud ECS

System: ubuntu14.04

FTP is a TCP-based protocol, generally require two ports 21, 20, need to open two ports in ECS security group, but after opening, Ali cloud will be prompted to 21 ports of high-risk, all sorts of problems after remote login, so here we do not use port 21, use other ports. We open port 5000 instead of the safety group 21 ports, and then turn 5001,5002,5003 three ports, the role of these three ports behind us say.

Into the console ( I am using the root user, so the back of the order shall be omitted sudo, non-root users are able to successfully install this manner are not sure )

1. Install the FTP service.

apt-get update

apt-get install vsftpd

Configuring an FTP server configuration file

The vsftpd.conf FTP server configuration file, the / etc directory, vary the specific location, etc in the I / under

vim /etc/vsftpd.conf

Edit Profile

There are many options for the configuration file, the specific function is not reproduced here, learn more themselves Baidu, here we focus only say

listen=YES

anonymous_enable = NO (do not allow anonymous logins, security considerations)

local_enable=YES

write_enable = YES (to allow write)

local_umask=022

connect_from_port_20=YES

chroot_local_user=YES

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd.chroot_list

pam_service_name = ftp (default vsftpd, here to ftp)

The above are the basic system comes with configuration options, you can modify, you need to add the following as an option

pasv_enable = YES
pasv_address = ipaddr (your Ali cloud public IP)
pasv_addr_resolve = yes
pasv_min_port = 5001
pasv_max_port = 5003 (port passive mode you want to use, that is, we opened before the port)
listen_port = 5000 (listening port, from 21 change 5000)

Save changes.

Ali goes on we use ftp passive mode, you need to open a few ports for data transfer

3. Modify the service port

vim  /etc/services

ftp      21/tcp

fsp     21/udp

change into

ftp    5000/tcp

fsp   5000/udp

4. Modify the firewall

ufw allow 5000

ufw allow 5001

ufw allow 5002

ufw allow 5003

ufw reload

Restart the firewall

View port

netstat -tlunp or ufw status

We opened a few ports are listen, explain set successfully.

Restart ftp service

service vsftpd restart

5. Log test

You can use your own FTP client tools, remember to choose to use passive mode, because we configure the server is in passive mode

The following test local terminal (local terminal you need to install ftp)

ftp ipaddr port

Enter the account password

After a successful login, the ls command prompt

500 Illegal PORT command.
ftp: bind: Address already in use

Description active mode can not be used

Entering passive mode

quote pasv

Then perform passive acknowledgment enter passive mode

This time the ls command, you can see the files under the ftp server, of course, if you are not using the root user, you need to set the permissions after the relevant folder can be used in the server, not described in detail here.

 

 

Guess you like

Origin blog.csdn.net/LZPRO/article/details/89031606