Changing Your Root Directory

The UNIX file system has one root directory, on which all other file systems are mounted. It is often desirable to limit the exposure of the entire file system to a smaller portion when dealing with potentially hostile users. This approach is commonly used by ftp(1) servers.

An anonymous ftp(1) server could be established with all of its files and subdirectories in the directory /home/ftp. Additionally, the directory /home/ftp/pub might contain public files for downloading. At startup, the ftp(1) server would change its root directory to the directory /home/ftp. From that point forward, the public directory would be known to the server as /pub instead of /home/ftp/pub. This prevents the client user from accessing ...

Get Advanced UNIX Programming 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.