Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mount Windows shares on proper paths in OS X Network
Often from my friends in Window's land, I get the paths like this:
\SERVERsharepathtofile.txt
When converted to a file URL on the Mac, this will look something like:
file://SERVER/share/path/to/file.txt
Unfortunately, when I mount the volume on OS X using the normal method, the share shows up under /Volumes with a naming scheme not compatible with the file URL above. My workaround involves making a directory and mounting:
  1. Mount the server the normal way (Command-K in Finder).
  2. Check Remember Password option when authenticating.
  3. Unmount the drive in the Finder -- very important!
  4. Make a directory in Terminal with the sever and share name: mkdir -p /SERVER/share.
  5. Mount the server with the command mount_smbfs //`whoami`@SERVER/share/ /SERVER/share. NOTE: if your short Unix username does not match your Windows server login, make it match. If it requires a domain, things like NNN\;bray are perfectly acceptable.
Once this is done, you should test it out and click on the file URL. This should bring up the program in the same application as if you had double-clicked on the file as assigned by Launch Services.

To take it a bit further, you can mount the drive from startup.
  1. Create directory mkdir -p /Library/StartupItems/AutoMount
  2. Create two files, AutoMount and StartupParameters.plist in that directory. In the AutoMount file put the following:
    #!/bin/sh
    . /etc/rc.common
    # The start subroutine
    StartService() {
       mount_smbfs //NDNW:bray@SERVER/share/
    }
    
    # The stop subroutine
    StopService() {
      unmount SERVER/share
    }
    
    # The restart subroutine
    RestartService() {
     StopService
     StartService
    }
    
    RunService "$1"
    In the StartupParameters.plist file goes this:
    {
      Description     = "Mounts";
      Provides        = ("Mounts");
      OrderPreference = "Late";
      Messages =
      {
        start = "Starting Software Update service";
        stop  = "Stopping Software Update service";
      };
    }
You should restart, and the drive should mount automatically. If you do not see it, look in your Console for notes. I tested the method on 10.4, but it should work on 10.5, as well. If you want to be technical, you may find more details on this process in this developer's note on Apple's site.

[robg adds: I have modified the formatting and some of the content from the original blog post provided by the hint's author.]
    •    
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[30,123 views]  

Mount Windows shares on proper paths in OS X | 2 comments | Create New Account
Click here to return to the 'Mount Windows shares on proper paths in OS X' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Mount Windows shares on proper paths in OS X
Authored by: musox on Dec 28, '07 01:34:46PM
I've been trying to get this to work using 10.5.1 on W2k3 Share file. Things that I have found are:
  1. Spaces are evil; If you have a space in the share, get your admin to create another share without spaces (as to not interfere with the current user base)
  2. Escape "$" for hidden shares (/SERVER/HIDDEN\$/)
  3. ensure the AutoMount and StartupParameters.plist are chmod +x
  4. To unmount it is "umount" (remove that first "n")

---
http://musox.com

[ Reply to This | # ]

Can't get mount_smbfs to work under Leopard
Authored by: jimgagne on Feb 05, '08 12:39:42PM
I hope this is the right forum for this question; I'd love if someone could direct me elsewhere if you know where. One of my projects involves importing data from files located on a Windows 2000 server on our intranet and then creating management reports. Because the data I'm importing changes several times a week, I wrote a Ruby script to mount the SMB share and import the data, using mount_smbfs. It's not my server and I can't change any of its names. The server is called just "SERVER," and the directory I want to mount has the format "ABC (D)" (yes, that's an imbedded space). So the command line command is
 mount_smbfs "//user:password@SERVER/ABC (D)" /Volumes/server 
This worked FINE under Tiger. Then I converted to Leopard. It took time, but I got my project working fine under Leopard. I can do the import so long as I manually copy the files from the server to the program directory on my iMac: the iMac has no problems seeing the server. But when I try the above command line (either in the script or directly in Terminal), I get an error:
 mount_smbfs: failed to intitialize the smb library: Invalid argument 
It gets worse. I tried using some of the other Mac tools to mount the server at /Volumes/server. Now I have another directory under /Volumes/server, also called "server". Any time I try to access or remove the directory (even as root), I get the following error message:
 ls: server: Disc quota exceeded 
What in the world does that mean? It's even there after shutting down and restarting the iMac. I tried calling Apple about these apparent new Leopard bugs and got the runaround. Any thoughts/suggestions?

[ Reply to This | # ]