Posted on 09-26-2014 12:56 PM
I’m hoping someone has a solution for this. I have a few network shares (AFP / SMB) that mount when a user logs in. When the share mounts, it automatically opens up. I don’t want that to happen. I just want the share to mount without it opening.
Does anyone know how to solve this issue without the use of an additional script?
Is there a defaults write command that can be issued to a certain plist?
Any help would be greatly appreciated.
Thanks
Keith
Posted on 09-26-2014 01:00 PM
mkdir /tmp/cs
mount_smbfs -o nobrowse //domain;user:password@SERVER/CasperShare /tmp/cs
Posted on 09-26-2014 01:01 PM
if you cannot tell the nobrowse option is the key
Posted on 09-26-2014 01:10 PM
The below doesn't open the shares, but adds them to the desktop.
http://macmule.com/2011/09/08/how-to-map-drives-printers-based-on-ad-group-membership-on-osx/
I'm guessing you're adding the shares as "Open at login"?
Posted on 09-26-2014 01:14 PM
nessts,
I appreciate your prompt reply. The command you sent does work but it actually hides it from the desktop. I still want to be able to see the share on the desktop, I just don't want it to automatically open when it's mounted.
Keith
Posted on 09-26-2014 01:17 PM
bentoms,
Thanks for you response. I'm looking for a way to accomplish this without additional scripts. My gut tells me theres a plist somewhere that is responsible for opening a share when it's mounted on the desktop.
Keith
Posted on 09-26-2014 01:20 PM
@kmitnick How are you getting the shares to mount at login? I think it maybe the method that is making them open, as its not common.
Posted on 09-26-2014 01:24 PM
It happens regardless of how it's mounted. for example, Go>Connect to Server> or via a login item, or via a profile.
Once the share mounts on the desktop, it opens up. Similar to how a DVD or CD would open on mount back in the day.
Keith
Posted on 09-26-2014 01:42 PM
Then use @nessts command and remove the -o nobrowse. It will mount and be visible in the Finder, but not auto open. There is a -noautoopen flag you can use when mounting disk images from a command line with hdiutil, but mount_smbfs doesn't have a similar flag.
Also, I don't think there is a simple plist to control that behavior, so you may not have a choice but to use a scripted method to stop that from happening.
Posted on 09-26-2014 09:02 PM
Appreciate your comments. What's puzzling me is if I mount and afp share using apple script or automator, it will not automatically open. When I mount the afp share from Go>Connect to Server, it will automatically open the share in the finder.
I'm trying to figure out what Go>Connect To Server doing differently than applescript or automator. The has to be a setting somewhere that tells the finder to open the share when using Go>Connect to Server.
Not a show stopper but I hope to figure this out one day.
Thanks for the assistance.
Keith
Posted on 08-15-2016 05:45 AM
What was the solution to this?
Posted on 08-20-2016 03:06 PM
@panacea FWIW, the solution in my post here mounts the shares only & doesn't open a Finder window.
Posted on 01-30-2019 05:03 PM
Dear Keith,
Did you ever find a solution to suppress this behavior? I've tried to figure it out myself for a long time. Never seen it discussed anywhere else. I routinely mount several shares with Command-K in the finder with just a couple of keystrokes and then I have to hit Command-W half a dozen times just to clean up the mess. I can't imagine no one else has this problem!
I've even gone through the extensive dotfiles found on github for macos (e.g. https://github.com/mathiasbynens/dotfiles/blob/master/.macos) but have still not been successful.
In particular, there are the following defaults described:
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true/false
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true/false
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true/flase
Yet even after changing all three of these to false, the finder still opens a window when I mount a remote AFP/SMB share. So I gave up. Any luck on your end?