Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a SAMBA share I mount on my Mac from time to time. I do this in Finder with Go > Connect to Server..., typing smb://192.168.1.1 into the Server Address field and pressing Connect. On the authentication dialog I choose to Connect Guest, and finally my remote share is mounted in /Volumes/<share_name>. This is great.

Can I achieve all of the above with a single command in Terminal? I tried some variations of the advice provided here, but there are two things missing:

  • how do I instruct mount to connect as guest?
  • how do I create the /Volumes/<share_name> directory on the fly, (so it doesn't have to exist before hand)?

Thanks!

share|improve this question
    
I believe you meant "so it doesn't have to exist beforehand" ? –  Martín Marconcini Mar 25 '11 at 12:21
    
Also, see apple.stackexchange.com/q/697/115 –  Martín Marconcini Mar 25 '11 at 12:23
    
@Martín good catch, I fixed the typo. The question you link to doesn't address the "connect as guest" issue, though. –  Mike Mazur Mar 25 '11 at 12:30

1 Answer 1

up vote 2 down vote accepted

In order to mount as "guest" you need to use another command: mount_smbfs

mount_smbfs -N //guest@server/share /some/existing/path

The "-N" is "don't ask for password" (type man mount_smbfs for more info).

As for the second part of how to create it on the fly (the path) I believe that it's not possible. The mount command doesn't create it on the fly and even the man pages mention the "correct" way is to mkdir first then mount.

See the man page for mount_smbfs.

share|improve this answer
    
Thanks for digging up the -N argument, that's what I was looking for. The creation/removal of the destination directory I can work around in a script. –  Mike Mazur Mar 25 '11 at 13:45
    
@Mike You're welcome. –  Martín Marconcini Mar 25 '11 at 14:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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