Monday, July 23, 2012

FTP and SFTP Article

FTP (File Transfer Protocol) is an older protocol for moving files back and forth over the Internet and other networks. All modern web browsers still speak FTP, which was sometimes used as a substitute for HTTP in the early days of the web. FTP is still used often as a means of downloading large files.

Many web hosts still offer FTP as the preferred way of uploading new web pages to a website. However, because there is no encryption of your password, FTP is not the best choice for this purpose. And since there is no encryption of the files being moved, FTP is a poor choice indeed for more sensitive information.


SFTP (Secure FTP) is a popular replacement. Built on SSL, SFTP is just as secure as HTTPS. And most modern FTP clients, such as the free, high-quality FileZilla program for Windows, support both FTP and SFTP. SFTP offers a set of features quite similar to FTP and will be immediately familiar to FTP users, although it works quite differently "under the hood."


Every Windows, MacOS X and Linux system comes standard with a simple command line FTP client program. And MacOS X and Linux also have command line SFTP clients as standard equipment. In addition, MacOS X supports connections to FTP servers in a user-friendly way, right out of the box (you can find a great tutorial on creativemac.com).

Binary Mode and ASCII Mode in FTP
"Classic," non-secure FTP can move files in two major ways: "binary mode" and "ASCII mode." Binary mode just moves the file down the wire without modifying anything... and this is, almost always, what we want today.

"ASCII mode" is sometimes used for plain-text (usually, .txt) files. ASCII mode, named for the American Standard Code for Information Interchange which determines what byte stands for each letter, number or other character in text, corrects for differences in the way line endings are stored in text files. Windows traditionally uses a carriage return (represented by an ASCII value of 13) followed by a line feed (represented by 10). Unix typically expects just the line feed. And MacOS, at least prior to MacOS X, preferred a carriage return only.


Today, though, most text-editing and viewing programs can view text files that follow any of these three conventions (including Microsoft Word, and the free WordPad program that comes with Windows, but excluding a few annoying holdovers like Windows Notepad). So ASCII mode doesn't do us much good. These days ASCII mode is mostly an annoyance, something people accidentally leave on in a very old fashioned command-line FTP program, or accidentally turn on in a newer one. And when you're moving a program, an image or anything else with an exact file format that must not be modified, that means you get garbage instead of the file you wanted.


The norm today is for FTP to simply ship files unchanged in binary mode.


Once upon a time there was also something called "TENEX mode," to move files between computers that didn't even use the same number of bits to represent a byte. Yes, FTP has been around that long! But TENEX mode doesn't come up as an issue these days, and we're all happier for it.

No comments:

Post a Comment