阿里云服务器使用FTP传输文件
一、更新源
我使用的阿里云ECS是Ubuntu18,我查看他默认的更新源,好像也是阿里的网站,可是我也不清楚为什么不能下载ftp
然后索性不管了,重新更新一次源,先将其备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
然后将sources.list
修改为如下内容
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
修改完后使用命令更新
sudo apt-get update
二、ubuntu18安装FTP服务
然后安装FTP 服务:
sudo apt-get install vsftpd
安装完成以后使用vi 打开/etc/vsftpd.conf进行配置,命令如下:
sudo vi /etc/vsftpd.conf
打开以后vsftpd.conf 文件以后找到如下两行:
local_enable=YES
write_enable=YES
确保上面两行前面没有“#”,有的话就取消掉,完成以后如图所示:
修改完vsftpd.conf 以后保存退出,使用如下命令重启FTP 服务:
sudo /etc/init.d/vsftpd restart
三、设置阿里云ECS的安全组
因为阿里云服务器有默认的安全组保护,所以我们要将FTP需要使用的端口放开使用。
进入阿里云控制台,点击【更多】->【网络和安全组】->【安全组配置】
然后选择【添加安全组配置】
将20和21端口加入安全组,允许访问,确定保存
四、FTP连接
然后我们打开【FileZilla】,点击打开站点管理器:
选择【SFTP】协议,输入阿里云的公网IP地址,然后是用户名和密码
点击【连接】,即可连接