7

I'm trying to setup autofs 5 on Debian 9 (Stretch).

I want to mount nfsserver:/top/dir/tools to my /top/dir/tools

Read only is fine in this case and I'm not worried about uid mapping.

auto.master has a line:

+dir: /etc/auto.master.d

I'm guessing that there is a one line file I can stick in /etc/auto.master.d that sets up the above mount. The man pages are a bit hard to follow here, but I'm guessing someone has done this and it's probably easy.

Does anyone have sample file from /etc/auto.master.d or an example of a simple autofs mount?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Dan Christian
  • 376
  • 2
  • 8

1 Answers1

10

After reading through the man pages for way longer than I wanted, I came to the conclusion that you can't do it with one file. The power of +dir: is that it lets you add files to set the configuration so you don't have to edit any package files.

Anything in /etc/auto.master.d is literally included into /etc/auto.master and uses that syntax.

The actual mount has to be in it's own file and has a different syntax.

Here is my /etc/auto.master.d/tools.autofs:

/top/dir    /etc/auto.tools

All it does is to place a secondary file into the directory tree and then reference a second file with the mount details. Here is /etc/auto.tools:

tools -ro  nfsserver:/top/dir/tools

That works, but I eventually settled on using systemd.automount in this case. It works fine for simple mounts like this, and means one less package to install and configure. For what it's worth, it also needs two files to get everything configured.

αғsнιη
  • 40,939
  • 15
  • 71
  • 114
Dan Christian
  • 376
  • 2
  • 8