1

On macOS I am attempting to set up an automount for a mount point with spaces.

/etc/auto_master contains:

#
# Automounter master map
#
+auto_master            # Use directory service
/net                    -hosts          -nobrowse,hidefromfinder,nosuid
/home                   auto_home       -nobrowse,hidefromfinder
/Network/Servers        -fstab
/-                      -static
/-                      auto_afp        -nosuid

and /etc/auto_afp contains:

'/mnt/mount point'    -fstype=afp    'afp://username:passwd@hostname/share%20name`

When I execute: sudo automount -vc, I get the error noted:

automount: dir '/mnt/mount point' must start with '/'
automount: /net updated
automount: /home updated
automount: /Network/Servers updated
automount: no unmounts

It has also failed if I use %20 without quoting (in that case it includes %20 in the mount point name).

How does one properly add spaces in a mount point?

ylluminate
  • 1,155
  • 2
  • 17
  • 35

1 Answers1

1

You can escape with a backslash '\' character.

/mnt/mount\ point -fstype=afp 'afp://username:passwd@hostname/share_name'

How about "/mnt/mount point" or /mnt/"mount point"?

Another option is to use a name without a space.

Further research led me to this page about mounting folders another way.

The key here is that in Posix systems, the mount table is space delimited. So if your path includes spaces, they have to be escaped. Author of that page thinks \040 may be the escape character in OSX. If so, the syntax would be /mnt/mount\040point. He also noted that the solution was only tested in Leopard. Also, Craig Watson was pointing you here as well in the comments above.

Jeter-work
  • 845
  • 4
  • 15
  • Unfortunately that did not work. It only create `/mnt/mount\\ `. – ylluminate Aug 09 '16 at 21:22
  • Now I suspect you're only guessing. – Michael Hampton Aug 09 '16 at 21:55
  • @MichaelHampton I want to say the escape sequence worked in Linux. I may be thinking of mount and /etc/fstab instead of automount. The ask osx exchange site has one or more questions like this, unanswered. But yes, my subsequent attempts are guesses. – Jeter-work Aug 09 '16 at 21:57
  • @ylluminate My suggestion was based on Linux, where '\' is not an allowed character in path names because the \ is an escape character. – Jeter-work Aug 09 '16 at 22:01
  • Yes, \ is an escape character. The rest of your statement is false. You can put a \ in a filename quite easily if you escape it (you already know the escape character, it would be '\\' to include one). –  Aug 09 '16 at 23:13
  • A simple test proves you're right. Another difference that sets Posix apart. – Jeter-work Aug 10 '16 at 13:15