I've found instructions on how to auto mount an SMB share, but they either involve adding the share to the login items (I'm using a laptop and that gives me an error when I'm not in the same network as the SMB share), or adding my login and password into the fstab or auto_master file (if I change my password, as I should, I have to go reconfiguring the system).

My user and password are stored in the keychain, and I only want the system to mount the share when I'm in the same network. I'm lazy and I want this to happen automatically. Is it possible?

Yes, it is possible, but you'll either need an non-lazy friend or put in the work yourself in order to set it up.

First thing I thought of was creating a shell script that monitors your networks connection details and executes the appropriate autologin and automount commands when it sees that you are connecting to the right network.

So, to answer your original question, yes it is possible.

  • I use an app called ControlPlane that allows you to set various contexts that define which commands or scripts should run in different places. I specifically use it to automount shares depending on whether Im at home or work or using the vpn, etc. controlplaneapp.com – rchrdg Feb 8 '15 at 20:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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