基于ECS搭建FTP服务笔记
连接ECS服务器
windows平台下
1. 使用cmd或PowerShell命令行输入工具。
2. ssh -V命令检查是否已经安装OpenSSH工具。
3. 连接服务器: ssh root@123.123.123.123 回车输入密码即可登录。
安装vsftpd
安装vsftpd,命令:yum install -y vsftpd
[root@iZuf67gjh27h6cqb2mphnwZ ~]# yum install -y vsftpd
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00
epel | 4.7 kB 00:00
extras | 2.9 kB 00:00
updates | 2.9 kB 00:00
(1/7): epel/x86_64/group_gz | 95 kB 00:00
(2/7): base/7/x86_64/group_gz | 153 kB 00:00
(3/7): extras/7/x86_64/primary_db | 206 kB 00:00
(4/7): epel/x86_64/updateinfo | 1.0 MB 00:00
(5/7): updates/7/x86_64/primary_db | 4.5 MB 00:00
(6/7): base/7/x86_64/primary_db | 6.1 MB 00:00
(7/7): epel/x86_64/primary_db | 6.9 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-27.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================
Package Arch Version Repository
Size
========================================================
Installing:
vsftpd x86_64 3.0.2-27.el7 base 172 k
Transaction Summary
========================================================
Install 1 Package
Total download size: 172 k
Installed size: 353 k
Downloading packages:
vsftpd-3.0.2-27.el7.x86_64.rpm | 172 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : vsftpd-3.0.2-27.el7.x86_64 1/1
Verifying : vsftpd-3.0.2-27.el7.x86_64 1/1
Installed:
vsftpd.x86_64 0:3.0.2-27.el7
Complete!
设置FTP服务开机自启动,命令:systemctl enable vsftpd.service
[root@iZuf67gjh27h6cqb2mphnwZ ~]# systemctl enable vsftpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
启动FTP服务,命令:systemctl start vsftpd.service
查看FTP服务监听的端口,命令:netstat -antup | grep ftp
[root@iZuf67gjh27h6cqb2mphnwZ ~]# netstat -antup | grep ftp
tcp6 0 0 :::21 :::* LISTEN 1453/vsftpd
#其中21即为监听的端口号
匿名用户模式下配置vsftpd
1.修改配置文件vsftpd.conf
vim /etc/vsftpd/vsftpd.conf
将文件中anon_upload_enable=YES前面的#号删去
2.更改/var/ftp/pub目录的权限,为FTP用户添加写权限
chmod o+w /var/ftp/pub/
3.重启FTP服务
systemctl restart vsftpd.service