Technical Anshu
Tutorials Blog
协议基础知识

SFTP 与 FTP 为什么普通 FTP 已完成

两者都移动文件。 One of them broadcasts your password to anyone listening on the path.如果您今天要选择一种方案,本页将以事实而非流行方式结束辩论。

By Technical AnshuUbuntu Server7 minute read
在视频中逐步观看完整的 Ubuntu SFTP 服务器设置

FTP is older than the web, and it was designed for a friendlier internet where nobody on the wire was assumed hostile.这个假设已经死了。下面是每种协议中实际在网络上传输的内容、为什么防火墙团队讨厌 FTP,以及您仍然会遇到它的地方 - 不知道其他任何内容的旧设备。

What a listener on the network sees
FTP loginUSER admin PASS office123
FTP filesalary.xlsx - fully readable
SFTP loginencrypted - nothing readable
SFTP fileencrypted - nothing readable
共享或受感染网络上的数据包捕获会像明信片一样读取 FTP。 SFTP 的相同捕获仅显示噪音。
1

密码以纯文本形式传输

这不是理论上的弱点。 In FTP the username, the password and every byte of every file cross the network exactly as typed, as the panel above shows.位于该路径上的任何人(办公室 LAN 上的恶意设备、受感染的路由器、共享 Wi-Fi 上的邻居)都可以读取所有内容,而不会攻击任何内容。

SFTP encrypts the entire session before any credential is sent, and it also checks the data for tampering on the way.同一个监听器没有得到任何可用的东西。

2

一个端口对抗一个移动目标

FTP uses port 21 for commands and then opens separate, shifting connections for the data itself.防火墙和 NAT 路由器必须猜测并戳出额外的漏洞,这就是 FTP 经常半途而废的原因:登录成功,文件夹列表或传输挂起。

SFTP 通过端口 22 上的单个 SSH 连接运行所有内容。防火墙中的一条规则,无需配置被动端口范围,并且它在几乎所有网络中的行为都是相同的。

3

FTPS 是第三种不同的东西

不要让相似的名称混淆在一起:

  1. FTP - 纯文本,完成,避免
  2. FTPS - 包裹在 TLS 中的旧 FTP 协议;安全,但它保留了 FTP 的多端口防火墙问题
  3. SFTP - 完全不同的协议,基于 SSH 构建;安全且单端口

When a client says their software supports "secure FTP", check which of the last two it means. They are not interchangeable and the wrong choice fails silently at connection time.

There is also a speed myth worth retiring: the encryption in SFTP costs almost nothing on any modern machine. People repeat benchmarks from twenty year old hardware as if they were laws of nature.在当今使用的 PC 和服务器上,您的网络和磁盘在加密之前就会变慢,因此速度从来都不是保留普通 FTP 的诚实理由。

4

老实说 FTP 仍然出现的地方

Honesty matters here: you will still meet FTP in the wild. Some old network printers, CCTV recorders and legacy machines offer nothing newer.规则是遏制,而不是恐慌:

  1. 仅将此类设备保留在本地网络上 - 切勿将 FTP 暴露到互联网
  2. 为设备提供自己的帐户和未在其他地方使用的密码
  3. 在任何有选择的地方都可以使用 SFTP 移动文件,让旧的角落保留在角落

观看完整视频

See the whole Ubuntu SFTP setup done live, with the exact clicks and commands, in the Technical Anshu video.

Watch Full Video
常见问题解答

SFTP 与 SSH 上的 FTP 或 FTPS 相同吗?

不会。SFTP 是内置于 SSH 中的自己的协议。 FTPS is the original FTP protocol with TLS added. The names look alike but the software, ports and behaviour are different.

有人真的能那么轻松地读取我的 FTP 密码吗?

是的。 A free packet capture tool on the same network shows FTP credentials in plain text within seconds. This is the main reason plain FTP disappeared from serious use.

我的旧设备仅支持 FTP。我必须更换它吗?

不是立即。让它远离互联网,给它一个唯一的密码,并将其限制在一个文件夹中。按正常升级周期更换,不要惊慌。

本指南基于技术安数 Ubuntu SFTP 服务器视频 - 卡在步骤上?在视频评论中提问,您将得到回复。