2

I've read the following in a website [1]:

/etc/exports is very sensitive to whitespace - so the following statements are not the same:

/export/dir hostname(rw,no_root_squash)  
/export/dir hostname (rw,no_root_squash)

The first will grant hostname rw access to /export/dir without squashing root privileges. The second will grant hostname rw privileges with root squash and it will grant everyone else read/write access, without squashing root privileges. Nice huh?

How does it grant everyone else read/write access? How does that whitespace affect privileges in this way?


[1] http://nfs.sourceforge.net/nfs-howto/ar01s07.html

4

This is because it sees that line as exporting it to two separate endpoints:

  1. hostname (a host), for which the default options will apply.

  2. (rw,no_root_squash) (set of options), for which the default host (any host!) will apply.

  • Oh, so is it equivalent to /export/dir hostname(default_options) ..*.*(rw,no_root_squash)? Also, what are the default options? And also, does it matter if I put a space between the options like so: (rw, no_root_squash)? – Haggra Aug 1 '18 at 7:43
  • 1
    Yes, it's equivalent. I'm fairly sure you may not have spaces within the options either. It's a horrible file format! – filbranden Aug 1 '18 at 8:00
  • I would also appreciate if you could direct me to where I can find out about default options or just answer here. – Haggra Aug 1 '18 at 10:11
  • 1
    See the man page for exports. Some options (e.g. sync vs. async) will have different defaults depending on the version... Different NFS servers (e.g. not on Linux) might have different interpretation of the exports file too... Overall, if you need to use it, be as strict as you can. Test everything to ensure it behaves as you expect it to. – filbranden Aug 1 '18 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.