Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why do some Linux admins bind their folders to /export before exposing them via NFS (through hosts.allow and /etc/exports)?

Why not just point /etc/exports to the directory you want to expose via NFS?

share|improve this question

closed as off-topic by allquixotic, Heptite, Kevin Panko, warren, Moses Apr 7 '14 at 1:31

  • This question does not appear to be about computer software or computer hardware within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Belongs on – warren Apr 4 '14 at 16:43
up vote 1 down vote accepted

It's a matter of convention, like almost all file path related stuff.

One technical reason might be that you can configure the discretionary access controls for the top-level directory of a bind, separately from where it's mounted from. That means if you have a disk partition or image mounted to /mnt/foo, and you bind it to /export/foo, you can have a different permissions mask and different user/group owners for each separate mount point. Combining this with chroot or container-based virtualization would further allow flexibility where you can assign different amounts of permission (or no permission at all) to different users or different program contexts.

But if that sort of thing happens not to be needed in a specific environment where things are bound on /export, the question of "why not just..." is pretty vacuous: it's done that way more or less arbitrarily, just because, probably because they have some install or maintenance scripts that are written to assume that the folders are mounted or bound on /export.

The choice of how to lay out folders and mount points on disk is influenced by:

  • Software that the sysadmin wishes to run which assumes or defaults to looking at certain folders for certain things;
  • The sysadmin's own habits, personal taste and preferences (aka "just because");
  • The default settings of configuration scripts built into the operating system's base install;
  • Challenges the sysadmin may have encountered during installation/configuration of some software that requires moving around or restructuring folders in order to make everything happy with a minimal amount of effort (e.g. it may not be worth the sysadmin's time to recompile a complicated program just to eliminate a bind mount that the program expects).
share|improve this answer

Educated guess:

Safety reasons. Since NFS will by default not export content beyond filesystem boundaries you add an additional layer of data security when bind-mounting the to-be-exported directory do a special location.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .