当前位置:网站首页>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
边栏推荐
- Analysis on the market scale and pattern of contrast agents in China in 2021: Jiangsu Hengrui pharmaceutical, general electric, Yangzijiang Pharmaceutical Group, Bayer and bleco account for more than
- 请问通达信开户安全吗?
- QQ robot official plug-in loading configuration method [beta2 version]
- Analysis on the development trend of China's intense pulsed light equipment industry in 2021: the market scale is growing, and the proportion of imported brands is large [figure]
- 想知道新股民怎样炒股票开户?在线开户安全么?
- Basic operations and basic data types of MySQL database
- JS get data
- R language uses the model of DALEX package_ The profile function interprets the relationship between a continuous feature and the target value Y in multiple classification models based on the conditio
- Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]
- 2017 reading (word memory)
猜你喜欢
Current situation of China's hydraulic cylinder industry in 2020 (with application fields, policies and regulations, supply and demand status and enterprise pattern) [figure]
Leetcode-101-symmetric binary tree
[C language practice - print the upper triangle and its deformation (with blank version)]
为什么生命科学企业都在陆续上云?
Tiger DAO VC产品正式上线,Seektiger生态的有力补充
QQ robot: self forbidden words management of group members [latest beta2 version]
Basic operation details of binary search tree (BST) (complete code, including test cases)
How to sort massive data? How to process data between memory and hard disk?
On Oracle full stack virtual machine -- graalvm
LeetCode-78-子集
随机推荐
Network security detection and prevention test questions (V)
Detailed explanation of oauth2 - Introduction (I)
什么是算子?
跳一跳小游戏辅助(手动版本)py代码实现
User management and permissions
PHP数据库连接version1.1
初探Oracle全栈虚拟机---GraalVM
QQ机器人官方插件加载配置方法【beta2版本】
Network security detection and prevention exercises (III)
QQ机器人:群成员自我禁言管理【最新beta2版本】
Overview and trend analysis of China's foreign direct investment industry in 2020 [figure]
[C language practice - print the upper triangle and its deformation (with blank version)]
solidity 合约地址转钱包、钱包地址转合约
解决sublime Text3 package control 无法安装插件问题
Analysis on development status and development suggestions of e-commerce industry in Xinjiang in 2020 [figure]
TCP/IP 测试题(二)
QQ机器人闪照转发/撤回消息转发【最新beta2版本】
158 Bar _ Modèle Power bi utilise Dax + SVG pour créer des diagrammes d'affaires presque toutes les possibilités
[today in history] June 25: the father of notebook was born; Windows 98 release; First commercial use of generic product code
LeetCode-101-对称二叉树