osx - Automount SMB share when NAS becomes available

08
2014-07
  • FaNIX

    I have a NAS server at home which shares content through SMB. The NAS server isn't always on, only really use it when I need to, so I use WOL (WAKE ON LAN) etc...

    Is it possible to automatically mount the SMB shares once the NAS server is awake? Something to check if the server is up, and then automatically mount the shares?

    I'm using OSX Mavericks.

  • Answers
  • MariusMatutiae

    Actually, you can do better: you can mount the remote resources only when needed. This is done by means of automount, a program that comes with your OS.

    Suppose you have a NAS server called MyNAS, with a share called MyMusic, and you want to instruct automount to mount the share only if you are trying to access it. Then add this line

      /MyMusicMountPoint          auto_resources
    

    to the file /etc/auto_master; here /MyMusicMountPoint is whatever mount point you choose for the remote resource MyMusic. Then create a file called /etc/auto_resources with the following line:

     MyMusic -fstp=smbfs ://MyNAS/MyMusic
    

    Now, when you start automount by means of the simple command automount, you will find the SMB share in /MyMusicMountPoint/MyMusic.


  • Related Question

    osx - Configuring SMB shares in OS X
  • Craig Walker

    I'm at my wit's end trying to control SMB file sharing on my Mac. (OS X 10.5 Leopard).

    I want to do something fairly simple: share a particular (non-home, non-Public) folder over my my SMB/Windows network with two users (accounts are local to my Mac), and share no other folders with anyone.

    The instructions on the internet are fairly straightforward: add the folders to be shared to the File Sharing panel of the Sharing System Preferences pane:

    Sharing

    ..and ensure that I'm sharing through SMB:

    System Preferences

    However, when I actually try to connect via a SMB client (Windows XP in this case), the share does not appear. I see my home directory, "Macintosh HD", and my printers, but not the folder I just shared.

    I ensured that the underlying directory had the proper permissions (since this seems to affect share visibility) and that the "Shared Folder" checkbox was checked:

    alt text

    ...but this didn't have any effect.

    I checked /etc/smb.conf but there was nothing obviously out of place there. I've also restarted smbd and rebooted.

    What else should I be looking for?


  • Related Answers
  • Gordon

    Try setting a workgroup on the mac and the pc that is the same. On the mac it is set with system preferences for the network adapter. You could also try connecting by IP address instead of name.

  • thisislev

    I recommend you check out a program called SharePoints. It works perfectly on my server running Mac OS X! :)

  • James Polley

    My first guess was that the XP machine isn't supplying a username/password, so OS X is only showing it the "guest"-readable shares - but you say it's showing your homedir, so that musnt' be the case.

    My second guess is that the Samba hasn't been restarted and so the daemon hasn't seen the new share. Turning off SMB sharing and then turning it back on should fix this.

    My third guess is that it's something else.

  • Canadian Luke

    That is the intended behaviour using OSX to share on SMB. The other folders will be unavailable, but the user must navigate to the folder they ARE allowed to access