当前位置:网站首页>ECS 7-day practical training camp (Advanced route) -- day01 -- setting up FTP service based on ECS
ECS 7-day practical training camp (Advanced route) -- day01 -- setting up FTP service based on ECS
2022-06-25 19:06:00 【Student Zhao who loves learning】
be based on ECS build FTP service
install vsftpd
- Run the following command to install vsftpd.
yum install -y vsftpd
When returning to the interface shown in the following figure , Indicates successful installation

2. Run the following command to set FTP The service starts automatically .
systemctl enable vsftpd.service
3. start-up FTP service .
systemctl start vsftpd.service
4. Run the following command to see FTP The port the service listens on .
netstat -antup | grep ftp
The interface shown in the figure below appears , Express FTP Service started , The port number of listening is 21. here ,vsftpd Anonymous access is enabled by default , You don't need to enter your user name and password to log in FTP The server , But no permission to modify or upload files .
To configure vsftpd
vsftpd(very secure FTP daemon) It's one in Linux The most popular... In the distribution FTP The server .vsftpd Support anonymous access and local user mode . Anonymous access any user can access the built FTP service ; The local user mode only supports the added local users to access the built FTP service .
explain : Anonymous user mode and local user mode can only be configured at the same time .
Anonymous user mode
1. Modify the configuration file vsftpd.conf.
vim /etc/vsftpd/vsftpd.conf
Press i Key to enter edit mode , Anonymous upload permission anon_upload_enable=YES The notes of .
2. Press ESC Key to exit edit mode , Input :wq Save and exit vim.
3. change /var/ftp/pub Directory permissions , by FTP Users add write permissions .
chmod o+w /var/ftp/pub/
4. restart FTP service .
systemctl restart vsftpd.service

Local user mode
1. by FTP The service creates a Linux user .
adduser ftptest
Set the password for the user .
passwd ftptest

2. Create a supply for FTP The file directory used by the service .
mkdir /var/ftp/test
3. change /var/ftp/test The directory is owned by ftptest.
chown -R ftptest:ftptest /var/ftp/test
4. modify vsftpd.conf The configuration file .
To configure FTP For active mode, execute the following command :
sed -i 's/anonymous_enable=YES/anonymous_enable=NO/' /etc/vsftpd/vsftpd.conf # Prohibit anonymous login FTP The server
sed -i 's/listen=NO/listen=YES/' /etc/vsftpd/vsftpd.conf # monitor IPv4 sockets
sed -i 's/listen_ipv6=YES/#listen_ipv6=YES/' /etc/vsftpd/vsftpd.conf # lsnrctl stop IPv6 sockets
sed -i 's/#chroot_local_user=YES/chroot_local_user=YES/' /etc/vsftpd/vsftpd.conf # All users are restricted to the home directory
sed -i 's/#chroot_list_enable=YES/chroot_list_enable=YES/' /etc/vsftpd/vsftpd.conf # Enable the list of exceptional users
sed -i 's/#chroot_list_file=/chroot_list_file=/' /etc/vsftpd/vsftpd.conf # Specify exception user list file , Users in the list are not locked in the home directory
echo "allow_writeable_chroot=YES" >> /etc/vsftpd/vsftpd.conf
echo "local_root=/var/ftp/test" >> /etc/vsftpd/vsftpd.conf # Set the directory where local users log in
To configure FTP For passive mode, execute the following command :
sed -i 's/anonymous_enable=YES/anonymous_enable=NO/' /etc/vsftpd/vsftpd.conf # Prohibit anonymous login FTP The server
sed -i 's/listen=NO/listen=YES/' /etc/vsftpd/vsftpd.conf # monitor IPv4 sockets
sed -i 's/listen_ipv6=YES/#listen_ipv6=YES/' /etc/vsftpd/vsftpd.conf # lsnrctl stop IPv6 sockets
sed -i 's/#chroot_local_user=YES/chroot_local_user=YES/' /etc/vsftpd/vsftpd.conf # All users are restricted to the home directory
sed -i 's/#chroot_list_enable=YES/chroot_list_enable=YES/' /etc/vsftpd/vsftpd.conf # Enable the list of exceptional users
sed -i 's/#chroot_list_file=/chroot_list_file=/' /etc/vsftpd/vsftpd.conf # Specify exception user list file , Users in the list are not locked in the home directory
echo "allow_writeable_chroot=YES" >> /etc/vsftpd/vsftpd.conf
echo "local_root=/var/ftp/test" >> /etc/vsftpd/vsftpd.conf # Set the directory where local users log in
echo "pasv_enable=YES" >> /etc/vsftpd/vsftpd.conf # Turn on passive mode
echo "pasv_address=<FTP Server public network IP Address >" >> /etc/vsftpd/vsftpd.conf # In this tutorial ECS Server resilience IP
echo "pasv_min_port=20" >> /etc/vsftpd/vsftpd.conf # Set passive mode , Establish the minimum range of ports available for data transmission
echo "pasv_max_port=21" >> /etc/vsftpd/vsftpd.conf # Set passive mode , Establish the maximum port range available for data transmission
5. stay /etc/vsftpd Create under directory chroot_list file , And write the list of exceptional users in the file .
Use vim Command to edit chroot_list file , Add the list of exceptional users . Users in this list will not be locked in the home directory , You can access other directories .
vim /etc/vsftpd/chroot_list
explain : When there are no exceptional users , You have to create chroot_list file , Content can be empty .
6. restart FTP service .
systemctl restart vsftpd.service
This article is reproduced in : Ali advanced training camp
边栏推荐
- mysql视图讲解
- QQ robot epidemic situation query / epidemic situation concern [latest beta2 version]
- LeetCode 3. Longest substring without repeated characters & sliding window
- Cutting feet to fit shoes - talking about the ramp reconstruction on the track
- Tcp/ip test questions (I)
- 网络安全检测与防范 测试题(四)
- On Oracle full stack virtual machine -- graalvm
- Do you want to know how new investors open accounts? Is online account opening safe?
- Analysis of China's road freight volume, market scale and competition pattern in 2020 [figure]
- 解决sublime Text3 package control 无法安装插件问题
猜你喜欢

Leetcode-101-symmetric binary tree

Apifox simple understanding -- the integrator of web side testing

焕新出发,利尔智达天下

158_ Model_ Power Bi uses DAX + SVG to open up almost all possibilities for making business charts

On location and scale in CNN

Web development solution to cross domain problems

QQ机器人:群成员自我禁言管理【最新beta2版本】

Analysis on employment compensation of 2021 college graduates: the average monthly starting salary of doctors, masters, undergraduates and junior colleges is 14823 yuan, 10113 yuan, 5825 yuan and 3910

Elastic high-performance computing on the cloud supports the rapid development of the life science industry, reducing costs and increasing efficiency

Google cloud SSH enable root password login
随机推荐
削足适履 - 谈谈赛道上的坡道改造
利尔达蓝牙空调接收器方案助力打造更舒适的公路生活
QQ robot: self forbidden words management of group members [latest beta2 version]
Network security detection and prevention test questions (V)
Analysis on development scale and development trend of China's night economy industry in 2021 [figure]
网络安全检测与防范 练习题(三)
2017 reading (word memory)
Analysis on market scale and supply of China's needle coke industry in 2020 [figure]
Sorting out the latest data mining competition scheme!
QQ机器人闪照转发/撤回消息转发【最新beta2版本】
Why are life science enterprises on the cloud in succession?
How to quickly close port 8080
网络安全检测与防范 测试题(二)
PHP数据库连接version1.1
Analysis on China's aluminum foil output, trade and enterprise leading operation in 2021: dongyangguang aluminum foil output is stable [figure]
QQ robot epidemic situation query / epidemic situation concern [latest beta2 version]
Svn introduction and Usage Summary
solidity 合约地址转钱包、钱包地址转合约
MySQL transaction explanation
158_模型_Power BI 使用 DAX + SVG 打通制作商业图表几乎所有可能