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

Automount SAMBA (Windows) share points at boot Network
Today I was reading the wonderful tip on Automounting AFP and NFS Sharepoints at Startup, which is found on Mike Bombich's great Mac OS X site, and it occured to me that this might work for SAMBA (Windows) shares as well. I tried it, and sure enough, it does!

SAMBA sharepoints and standard Windows "shared directories" work in almost exactly the same way as AFP shares. The only difference is the URL that you use. If you want to dynamically mount a Windows (or SAMBA) sharepoint, follow the directions at Mike's site for a regular AFP Dynamic mount and replace the URL value with:

url==smb://username:password@servername/sharepoint
Where servername is either the IP address, hostname, or fully-qualified hostname (foo.example.com) of the machine that you would like to connect to, and where sharepoint is the shared directory that you would like to connect to.

In some cases, depending on the configuration of your network, this may not work. If that happens to you, try:


url==smb://Username:Password@Workgroup/servername/sharepoint
Note: I tested this on MacOS 10.2.8 and can make no promises or guarantees that it will work on any other version of OS X, but it worked for me. Because I have no reason to do so, I have not actually tested this with a static mount, only dynamic. The first URL I listed worked perfectly for me. However, in researching printing to SAMBA-shared printers, I saw many reports of a whole variety of different URLs working for some setups, and not working for others. I suggest that if the two URLs I provided don't seem to work for you, try variations on the theme, or search here for the tips related to printing to samba shared printers and SMB shares for ideas.
    •    
  • Currently 2.00 / 5
  You rated: 3 / 5 (6 votes cast)
 
[184,349 views]  

Automount SAMBA (Windows) share points at boot | 19 comments | Create New Account
Click here to return to the 'Automount SAMBA (Windows) share points at boot' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Automount SAMBA (Windows) share points at boot
Authored by: sebastienb on Oct 24, '03 01:00:54PM

This is probably a better way than, say, putting the drive in the login items for your account. Putting a samba share in the login item has caused me problems in the past (under 10.1x mostly)



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: slap on May 05, '04 08:26:23PM

here's a much more mac friendly type to mount NFS volumes on your computer. connect to the NFS (samba) server. On successful authentication a file will be generated in your account under the ~yourusername/Library/Recent Servers. Take that file and place it in your your Startup Items (Apple Menu > System Preferences > Accounts > Startup items). Logout and log back in. It will launch that file and automount your NFS volume if you have the password in your keychain otherwise it will ask for authentication.

good luck thanks for the other insight.



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: Anonymous on Oct 24, '03 05:09:29PM

I've done the same thing with an AppleScript that I dropped into my Startup Items:


tell application "Finder"
	mount volume "smb://WORKGROUP;username:password@machine_name/directory"
end tell

Where workgroup is the name of the Windows workgroup/domain, etc. Basically the same information that you would enter in the SMB/CIFS authentication dialog box when you Connect To Server in the Finder.



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: richard788n on Oct 26, '03 02:20:40AM

How can I remount to a SAMBA share after waking my PowerBook from sleep?



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: odyssey on Apr 13, '04 09:14:24AM

Double click the AppleScript. It will then mount them.



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: mweymar on Jun 11, '04 10:20:23PM

Just guessing, but I think (s)he may've meant *automagically*; i.e., how do you - or *can* you - remount the directory automagically post-sleep?... Or do you *have* to double click the script?...

I'm curious about this too.



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: adinb on Dec 20, '05 02:06:56AM

Yeah, I'm looking for a better way to automount/automatically reconnect to all my samba shares after sleep as well.

I tried the automount tip but I just get the finder spinny ball o' doom and many iterations of the following in the console:

Dec 20 02:46:23 Dream automount[2716]: Can't mount destiny:/media on /private/Network/Servers/destiny/media: Invalid argument (22)


Here's a summary of the entry in the NetInfoManager:

name: server:/share
dir: /Network/Servers
vfstype: url
opts: (net, url==smb://workgroup;server/share)



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: slap on May 05, '04 08:27:29PM

here's a much more mac friendly type to mount NFS volumes on your computer. connect to the NFS (samba) server. On successful authentication a file will be generated in your account under the ~yourusername/Library/Recent Servers. Take that file and place it in your your Startup Items (Apple Menu > System Preferences > Accounts > Startup items). Logout and log back in. It will launch that file and automount your NFS volume if you have the password in your keychain otherwise it will ask for authentication.

please erase the one below.. thanks



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: mweymar on Jun 11, '04 10:17:43PM

You're on 10.3?... I'm on 10.2.8, and don't see Startup items under Apple Menu > System Preferences > Accounts. Or am I missing something?...

I did try sudo cp'ing the file you mention from Recent Servers to System/Library/StartupItems, however, but this does not seem to work. I.e., logging out, logging back in does not remount directory.

Again: Am I missing something?...

TIA,
Matthew



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: ashique on Aug 23, '04 11:57:54AM

what if I want the share to be mapped under different user/pass ? If I want the system to prompt for a user/pass on every login how do I do that?



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: zubin on Nov 02, '04 10:02:07PM

After alot of hassles automounting a Windows share, I finally got it working like this:

[code]
mount volume "smb://<authDomain>;<userName>:<password>@<serverName>.<domain>/<sharePoint>"
[/code]

Whilst authDomain and domain are often the same, they weren't in my case - I wanted the authentication to be via the computer's list of users, not the domain's, and so I entered the computer name for authDomain and that worked.



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: jakegoat on Aug 01, '05 02:32:10PM

This is a winner for me - thanks for such a simple solution. Works perfectly under 10.4.2 and is letting my automated backups run smoothly.

Thanks!
jakegoat



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: rmueller on Jan 28, '05 10:05:12AM

FWIW,

OS/X is suppose to be based on the BSD kernel correct?

FOR it's worth, one should be able to automount ANY filesystem in the /etc/fstab.. Well Apple as usual doesn't play by any rules or industry standards.

I've tried putting an "APPLESCRIPT" in the STARTUP items that calls a shell script..

I've tried setting up a cron job as root user to run the script.

I am resorting to Linux hack on one of my Linux mgmt boxes of an expect script to autologon to the MAC and run the script..

Frankly I have too many MACs and the stupid people that use them to phuck with each manually. I have too many other duties to babysit Mac users.







[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: edthered on Feb 04, '05 10:59:55AM

:)

That's the same problem I've been having... but enough about Apple's bastardization of *nix... ;)

I did find a command, I think on here but as usual I can't remember what it is now, that will load fstab into NetInfo. So you can set up your NFS mounts in fstab as you normally would, then load the fstab into NetInfo. It actually works, except for one small but somewhat fatal problem I'm having....

I'm mounting my apache (var/www) directory on a linux server and using Dreamweaver, I have the problem with all editors I have used though so it's not a DW problem, to edit the files on the server. The problem I have run into is that if DW sits for some time without any activity on the mount, the mount disappears to DW (or whatever) and I get the nice little notice box that says "your files have been deleted.....blah, blah".

I've mounted the /var/www directory from the linux box to /var/www on the mac and reset apache on the mac to use this directory, so I can have different versions of php to test scripts with. Apache on the mac doesn't seem to have a problem with this and even after I get the message from DW about the files disapearing, I can hit the web server on the mac and everything is there. What I have figured is that the NFS mount is really going through automount via NetInfo and is not hard mounted at /var/www and that automount is, for some reason that I can't really imagine, disconnecting the mount if it's not being used. If an app like finder or apache wants the mount back, it'll remount and everythings ok. But editors don't do a "search" type call through the finder, I'm just guessing on this one, so they see the file as being deleted.

As you can imagine this is a real pita when your trying to get some work done.

So my question to add to the mix is:

Does anyone know of a switch or a way to make the NFS mounts "persistant" to automount so that it won't disconnect them if it thinks they are idle? Right now I'm using SMB mounts on the linux server to mount the directories, but I really don't like having passwords for the users hanging around in files for anyone to find, so automounting SMB at startup is out of the question.



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: ClarkGoble on Jun 14, '05 02:22:00PM

Just a note to the above. If you have servers going up and down and a single script to connect to them all, you probably have had the joy of Applescript returning an error when you try to mount a server that is already mounted. Applescript then abandons the rest of your code so no other servers get mounted.

There is an easy way to fix this. Just surround each "mount volume..." command with a try and then end try. You have to do it for each line, otherwise if there is an error it will still skip the rest of your mounting. So you might have something like this.

tell application "Finder"
activate

try
mount volume "smb://WORKGROUP..."
end try

try
mount volume "smb://WORKGROUP..."
end try
end tell


[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: suman mehta on Aug 30, '05 08:39:37AM

I tried the same but had no luck in getting drive mounted.

is this URL correct

"url==smb://username:password@servername/sharepoint"

Is it really "==" or just type error? I am novice to mac please let me know.

I am using netinfo manager to dynamically automount smb drives.

All suggestions are welcome.

Thanks
Suman



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: ktula on Mar 28, '06 12:44:37AM

If you password contains the "@" character, then this can really present a problem.



[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: xylo on Dec 05, '10 06:29:22AM
No problem with AutomountMaker since version 1.2.0 !

[ Reply to This | # ]
Automount SAMBA (Windows) share points at boot
Authored by: cfraser on Nov 04, '06 01:05:05PM

Has anyone figured out how to _not_ hardcode the user credentials in the smb:// or afp:// URL and instead use the logged in user's credentials?

Background - I have a NAS device with a number of shares that I would like mounted at startup/login for each user. The default/guest permissions on these shares are Read-Only but I would like them mounted Read/Write using the logged in user's credentials to authenticate to the NAS.

I would have expected that NetInfo would include some support for environment variables but I've not been able to find a stitch of documentation detailing this.

Thanks very much



[ Reply to This | # ]