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

Avoid Finder problems with mount points Network

I have shares on two Samba servers with the same name - server1/home and server2/home. In trying to get OS X to work with them simultaneously,I have discovered three Finder bugs and a workaround for them.

Firstly, the bugs:

  1. Using the GUI to mount one share and then the other (using Connect to Server...), OS X gets confused and simply replaces the first share with the second. I can't access both shares at once!
  2. Switching to the terminal and using mount_smbfs to attach the shares to mount points (see other mount point hints on how to do this), the Finder gives an alias error on the second mount point folder if I have opened the first share before mounting the second. Note that this is purely a Finder problem, and the open/save dialog is happy to use both shares simultaneously.
  3. Writing a shell script to make sure that both shares are always mounted together, the Finder refuses to work with the mount point folders if the containing folder is open when the script is run - it can't seem to cope with the change in state from folder to mount point. This is probably a general mounting bug and not specifically related to my two shares having the same name.

Now the solution, if it's not clear already ... write a shell script to mount all the shares together, and make sure the folder containing the mount points is not open in the Finder when it runs:

#!/bin/bash
mount_smbfs //username:password@server1/home ./s1home
mount_smbfs //username:password@server2/home ./s2home

I know this script could be more secure etc. but it illustrates the point!

    •    
  • Currently 3.25 / 5
  You rated: 5 / 5 (4 votes cast)
 
[17,607 views]  

Avoid Finder problems with mount points | 15 comments | Create New Account
Click here to return to the 'Avoid Finder problems with mount points' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Avoid Finder problems with mount points
Authored by: bluehz on Mar 14, '03 11:22:16AM

Great tip! Thanks... another nicety I have discoverd in using Samba, is that you can create a file called .nsmbrc in your home folder and fill it with information such that you don't have to enter your login/password each time you connect. Makes the process much easier.

----------

# first create an encrypted password key for logging into
# your samba server. Use the same password you would
# normally use to login to the samba share
# use smbutil to create the encrypted password
# you must envoke smbutil as the user that the password is
# associated with. Replace "password_here" below with
# your password.

smbutil crypt password_here

----------

# the cmd above will generate an encrypted version
# of your password. Copy it to the clipboard.

#Create a file in your home dir and name it .nsmbrc

pico ~/.nsmbrc

----------

# Now enter the following data in the file:
# this is the MINIMUM I have found you can get away
# with. Character case matters also. I don't even have
# a defined workgroup on my samba server but the first
# line is required below. The must be in this order also.

# use the same info below if you don't have a workgroup

[default]
workroup=WORKGROUP

# this is the server name and ip

[LINUX]
address=192.168.1.130

# this is the actual server name and then your username
# paste in the password you generated above with smbutil
# for the "password_here" below, no quotes. Replace
# USERNAME with the same username associated above
# with the password

[LINUX:JIMBOB]
password=password_here

# you can enter as many shares/password combinations as
# want - always in the form:
# [SERVER:USERNAME]
# passwrd=password_here

There are many more options for the .nsmbrc file and it took me a while to get it to work. Make sure to chmod 600 the .nsmbrc file. Seems particularly finicky about case and order or items. You can read more info about setting this up here:

http://www.opensource.apple.com/projects/documentation/howto/html/osxsmb.html#using-mount

and here is another sample .nsmbrc file with more annotation.

http://gatekeeper.dec.com/pub/BSD/FreeBSD/FreeBSD-stable/src/contrib/smbfs/examples/dot.nsmbrc

Does anyone have any idea why when I leave my share from my linux box mounted on the OS X box for extended periods of time - the CPU usage of the samba daemon skyrockets to 80-90% even without actually doing anything on the share?



[ Reply to This | # ]
Avoid Finder problems with mount points
Authored by: bluehz on Mar 14, '03 11:51:10AM

Another really usefull - but obscure options is mapping your usernames from your OS X box to the box you are mounting in samba. You create user mapping file with lines correlating remote user and local user.

# create user mappings file
# location is not important as long as you point to it
# in smbd.conf (see below)

pico /usr/local/samba/lib/users.map

# then add remote = local for each user you wish to map
# for example, let say my username is jimbob on OS X
# box but everytime I mount the share volume I want to
# mount as root (that is root on the share volume) so I
# have editing capabilities everywhere. This assume you
# have root access to your share. So the single line in the
# users.map file would be:

root = jimbob

# enter as many as you like, each on a single line

---

# Then to activate the users_map, add this line in your
# samba config file (usually called smbd.conf) - make sure
# to change path below to where you created your
# users.map in above step.

username map = /usr/local/samba/lib/users.map

# also handy in your smbd.conf is this line to prevent OS X
# from littering shares with invisible .DS_Store files.

veto files = /.DS_Store/



[ Reply to This | # ]
Avoid Finder problems with mount points
Authored by: amit_kr on Mar 14, '03 01:09:34PM

Could one of you explain why one cannot simply login on to the windwos share once, and use the 'Add to keychain' option (on the user/password dialog) to save the credentials? After that, opening the share will not require any passwords (also applies if you have a shortcut to a deep folder within the share)



[ Reply to This | # ]
veto files doesn't work?
Authored by: Mithrandir on Mar 14, '03 07:39:46PM

I can't this option to work on my machine. I put it under the default heading in the conf file. Does it need to go somewhere special to work propperly? This would be fantastic if it worked!

Also is there a way to stop smb from littering shares with the ._fileName resource fork hack?

There is a hide dot files option that also doesn't seem to work.

Any ideas?

---
Josh

Ultimate Art Gallery
http://UltimateArtGallery.com



[ Reply to This | # ]
veto files works like this...
Authored by: Mithrandir on Mar 15, '03 05:29:47AM

Yes veto files does work it just doesn't quite do what was stated earlier. It doesn't prevent the Finder from creating the annoying .DS_Store file but instead hides it and restricts access to it from users accessing your Mac SMB shares. So these files would not be listed on a Windows machine connecting to your Mac.

I wonder if there is a way to prevent this file from being written to SMB and other Shares? A Finder hack?

---
Josh

Ultimate Art Gallery
http://UltimateArtGallery.com



[ Reply to This | # ]
veto files works like this...
Authored by: rarpsl on Mar 15, '03 10:34:34PM
You Want .DS.Store files written since they are what represent the DeskTop file on the Server (ie: Icons and File Names, Location of the Icons, View Options, etc.). You also need ._File- Name files there since they are your Macintosh Resource Fork contents for file File-Name. The problem is that the .DS.Store and ._File-Name files are Not being set as Windows "Hide" files so they are "seen" by Windows users.

[ Reply to This | # ]
Avoid Finder problems with mount points
Authored by: tupholme on Mar 15, '03 12:08:47PM
Update!

I need to add a hint to my hint! On bug number 3, I have since discovered that the Finder refuses to work with the mount point folders if the containing folder has been opened at all since startup! That's to say that even if it is closed when the script is run, if the containing folder was open previously the Finder will have trouble coping with the change in state of the mount point folders and will not be able to open them subsequently.

Make sure that if you have had the containing folder open you close it before shutdown, otherwise your next mount will be scuppered when you restart and the Finder re-opens the folder!



[ Reply to This | # ]
Avoid Finder problems with mount points
Authored by: hrbrmstr on Mar 14, '03 01:17:14PM

If you're connecting to a linux or Unix box, why not just use NFS? Built-in support; auto-mount on boot; no keychain problems.

---
Mind the gap...



[ Reply to This | # ]
Avoid Finder problems with mount points
Authored by: tupholme on Mar 14, '03 05:57:38PM

Good point, I could try that. At the moment I'm the only Mac user in a Windows office, though, so I'm trying to be the same bfore I try to be (or think) different.

One thing I am pleased about is that OS X allows us to turn off Netatalk on the Linux servers, which we had to run before to allow OS 9 to connect.



[ Reply to This | # ]
Avoid Finder problems with mount points
Authored by: bluehz on Mar 17, '03 09:16:58AM

I wish I could use NFS - I am connecting to a Linux Slackware server on our internal LAN, and over the past year or so, every once in a while I get a hankerin to get NFS working so I waste several hours in failed attempts. One time I did actually manage to get NFS working - but that day has passed. Even dove in over the wknd and tried and tried and tried again.... never get anything but repeating "NFS Portmapper Failure" on the OS X box.

So for me netatalk and Samba both provide instant gratification in the sense that they actually work!



[ Reply to This | # ]
Avoid Finder problems with mount points
Authored by: wgscott on Mar 17, '03 02:46:29PM

Check out NFSmanager at

http://www.bresink.de/osx/NFSManager.html

also see

http://chemistry.ucsc.edu/%7Ewgscott/xtal/backup_hfs_stuff.html

part B, section 2

if you need the NFS mount to be on all the time (like even when you log out).



[ Reply to This | # ]
Avoid Finder problems with mount points
Authored by: bluehz on Mar 17, '03 05:05:51PM

I have been using NFS Manager, tried CLI, I tried it all. The one time I did get an NFS to mount it was via NFS Manager - but that was months ago and it was a fluke... my point being... if NFS is this hard/finicky - why not go with something that works reliable - like netatalk or samba.



[ Reply to This | # ]
Can you drag-n-drop to Trash?
Authored by: wfolta on Mar 14, '03 04:54:31PM

I noticed that when I used mount_smbfs that if I tried dragging the resulting mount to the Trash, it hung the Finder and didn't unmount. Any tips for making this work?



[ Reply to This | # ]
Can you drag-n-drop to Trash?
Authored by: tupholme on Mar 14, '03 06:01:43PM

This is an issue I admit, and one that has been mentioned in earlier hints - the Finder appears to have as many bugs with unmounting as it does with mounting in the first place! I don't have an answer for it. At least it doesn't cause any problems at shutdown.



[ Reply to This | # ]
Can you drag-n-drop to Trash?
Authored by: wfolta on Mar 15, '03 12:42:32AM

One thing that looked like a key to me is that the Finder's mount_smbfs has an additional argument of "-o noautomounted" or something like that.

But I also got frustrated by a couple of other details that the Finder's mount handles and figured I'd have to write an entire shell script and didn't pursue this.



[ Reply to This | # ]