File Transfer Protocol (FTP)

FTP services run courtesy of the daemon. It allows the machine’s users to remotely access the filesystem, so that they can browse directory listings and transfer files to and from the machine. It obeys the filesystem permissions just as a login shell does.

Enabling Anonymous FTP

First, create a user named ftp, under which all anonymous FTP activity will occur. Since this account doesn’t represent an actual person, you should use the account creation method described in Section 11.2.2.

Create a home directory for ftp. (Be sure that ftp’s NetInfo directory correctly refers to this directory as its home.) The FTP server forbids an anonymous user from accessing anything on the filesystem outside of the ftp user’s home directory.

You can now populate this directory with whatever you’d like anonymous users to be able to browse and download. To make a typical FTP site, add a pub/ folder containing all the downloadables, as well as an introductory blurb in a welcome.txt file; many FTP clients automatically look for a text file with this name upon connecting to a site, and automatically display it if present.

For security’s sake, consider changing the ownership of all these files and folders to root using the chown command, and using chmod to make them read-only for all users. This will prevent anonymous FTP users from uploading (and perhaps overwriting) files as well as keep the directory safe from tampering by local users. (A /pub/incoming directory, ...

Get Mac OS X in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.