云服务器文件传输问题

最近再做一个web项目,目前决定先把应用放在云服务器上。我选择的云主机是aliyun的Ubuntu 16.04主机。部署好云主机环境后,就需要把我在本地开发好的程序上传到云主机了。刚开始打算用ftp协议来传输,于是参照网上的教程(Ubuntu 16.04下vsftpd 安装配置实例_服务器应用_Linux公社-Linux系统门户网站),安装vsftpd,设置相关参数,本地安装FileZilla。当一切都设好后,到最后一步却卡住了,使用ftp协议FileZilla怎么都连不上云主机。在网上搜了很多方法都无效,大部分认为问题出在云主机的防火墙,但我检查了我的云主机防火墙iptables服务根本没开启,最后还是没有找到原因。

云服务器文件传输问题_第1张图片

最后在Google上,搜解决办法的时候,无意中看到有人说‘不要用ftp,ftp不安全的,早就该废弃之类话’,而且提议用SFTP-SSH File Transfer Protocol来传输,而且FileZilla就支持该协议。二话不说,直接开试。点击如上图左上角的图标,进入Site Manager界面,选择SFTP协议,登录方式选择秘钥登录,秘钥用的就是云主机的连接秘钥。

云服务器文件传输问题_第2张图片
点击connect,大喜,果然急速连接成功。如下图,左边是本地目录,右边是云主机目录,连接成功后才会显示。上传文件操作极易,只需把左边的文件直接拖到右边即可。

云服务器文件传输问题_第3张图片
在terminal上查看云主机上的文件,刚刚拖进去的图片已经在云主机的硬盘里了。
云服务器文件传输问题_第4张图片

参考网站(可能需要FQ):
https://askubuntu.com/questions/315378/ubuntu-web-server-ftp-connection-timeout 第二个回答
https://ubuntuforums.org/showthread.php?t=2234950 第五个回答

以下是一位外国网友的留言,贴在下方可以参考一下:

I’m more concerned about anyone using FTP. That protocol should have died 15 yrs ago for a number of reasons. It is like telnet. You have ssh running already, so just use an sftp client. There are lots of nice clients for every platform, it will be secure since passwords aren’t transmitted as plain text. If you use Windows - WinSCP is a nice client. There are others. The commands map 1-for-1 to old-school FTP (by design), so there isn’t anything new to learn. Plus the 3 main FTP servers have each had back doors inserted in their source code over the years - I think it happened to 1 of them twice. Just for clarification, nobody has announced any back doors in the current FTP servers that I know. Also - about the only organizations that should still be using FTP are those that want so share all files on the system with the entire world and don’t care who grabs the files. FTP doesn’t usually play nice with firewalls either.

On my home network when NFS isn’t available between the systems, I usually use scp or rsync with ssh-key-based authentication. It is very convenient - much more than FTP or sftp. OTOH, I’ve been called “odd”, so I can completely understand folks using sftp between their Windows and unix-like systems. If you need lots of easy access from Windows, then CIFS (samba) which has next to ZERO security is what most organization use. Just to be fair, NFS can be configured with low security and no encryption too. Neither NFS nor CIFS should be used over the internet (at least without a good VPN).

If you just want to share files with the entire world, use http. If authenticated logins are needed, then scp/sftp are what you want. FTP should have been killed off years ago.

你可能感兴趣的:(云服务器文件传输问题)