patrick1610

Q: Is it possible to limit the autofs function to a specific network?

Hi,

 

When I am at home, I would like my MacBook Pro to connect to my NAS using AutoFS.

But, since this is on the local network, I don't want it trying this al the time when I am not at home.

Is it possible to limit this function to a specified network?

 

Regards,

Patrick

MacBook Pro (Retina, 15-inch, Mid 2014), OS X El Capitan (10.11.3)

Posted on Mar 28, 2016 4:29 AM

Close

Q: Is it possible to limit the autofs function to a specific network?

  • All replies
  • Helpful answers

  • by etresoft,Apple recommended

    etresoft etresoft Mar 28, 2016 5:26 AM in response to patrick1610
    Level 7 (29,051 points)
    Mar 28, 2016 5:26 AM in response to patrick1610

    Hello Patrick,

    You could probably do this with an executable map. See http://www.apple.com/business/docs/Autofs.pdf

  • by patrick1610,

    patrick1610 patrick1610 Mar 28, 2016 6:07 AM in response to etresoft
    Level 1 (4 points)
    Mac OS X
    Mar 28, 2016 6:07 AM in response to etresoft

    HI,

     

    How how could I use This for a specific network?

    I don't understand it as explained in the document..

     

    Regards,

    Patrick

  • by etresoft,Apple recommended

    etresoft etresoft Mar 28, 2016 8:13 AM in response to patrick1610
    Level 7 (29,051 points)
    Mar 28, 2016 8:13 AM in response to patrick1610

    Hello again Patrick,

    Using an executable map is a slightly different approach. It isn't network-specific. It is on-demand. You could setup an autofs mount and it might gracefully handle the missing server when you are not at home. You should try it. But if you use an executable map, then it wouldn't even attempt to make a connection unless you tried to access the mount point. You would only do that if you were at home.

  • by patrick1610,

    patrick1610 patrick1610 Mar 28, 2016 2:48 PM in response to etresoft
    Level 1 (4 points)
    Mac OS X
    Mar 28, 2016 2:48 PM in response to etresoft

    Hi,

     

    I tried it but can't figure out what to type to make it find my NAS.

    With autoFS I used Movies -fstype=afp afp://admin:PASSWORD@192.168.2.6/Movies

    With the executable map they say to use the following command:

     

    #!/bin/bash
    if [ $# = 0 ]; then # List keys

    echo my_stuff

    exit fi

    echo suse.baranaba.com:/opt

     

     

    What do I type to make it find my NAS?

    Thanks for your help so far!

     

    Kind regards,

    Patrick

  • by etresoft,Apple recommended

    etresoft etresoft Mar 28, 2016 5:13 PM in response to patrick1610
    Level 7 (29,051 points)
    Mar 28, 2016 5:13 PM in response to patrick1610

    Hello again Patrick,

    The first step is to setup autofs as if you were always connected to that network. Make sure that works (not guaranteed). Then, all your executable map (named /etc/auto_run for example) would look like this:

     

    #!/bin/bash

     

    if [ $# = 0 ]; then # List keys

      echo Movies

    exit fi

     

    echo afp://admin:PASSWORD@192.168.2.6/Movies

     

    Your /etc/auto_master file would look like:

     

    /Users/Shared/Mounts auto_run

     

    I just tested this and it worked, more or less. This kind of thing really isn't a priority with Apple these days. You will have to check to make sure permissions are correct. And check to see that is disconnects gracefully, more or less.

  • by patrick1610,

    patrick1610 patrick1610 Mar 29, 2016 1:22 AM in response to etresoft
    Level 1 (4 points)
    Mac OS X
    Mar 29, 2016 1:22 AM in response to etresoft

    Thanks for your clear explanation!

    I'll give this a try soon!

     

    Regards,

    Patrick