PDA

View Full Version : Mount smb shares on login




drummer21scum
Feb 4, 2008, 08:12 PM
Hi total newbie to mac os x, work in a server 2003 environment, starting to introduce mac's at work, using leopard...

i was just wondering if anyone knows the script to mount a windows share eg.
\\mySrver\myShare$ and then add it to the finder sidebar...

just sick to death of going to finder>connect to server etc

any help would be great ;)



larkost
Feb 4, 2008, 11:13 PM
There are a few different routes to go:

If you are in an "enterprise" setting, then there is a good chance that there is an Active Directory server in the mix, and you can then bind to the AD server, and your "home" folder can be auto-mounted at login. You just need to use the directory utility for that.

Another option is to make an alias of the folder (inside the share) that you want. Unlike Windows shortcuts, aliases can contain the data needed to get to the share.

Another option is to make the alias, then put it in your login items.

After that there are a whole number of other ways (mount_smbfs on the command line, MCX if you are really good, etc), but I think you should probably chose one of the first three.

jeremy.king
Feb 5, 2008, 08:29 AM
I use an Applescript application. Only because I didn't want to explain to the wife how to execute a shell script. A simple alias on the desktop, a double click, and Bam!


tell application "Finder"
mount volume "afp://username:password@hostname/sharename"
end tell

if you want SMB, simply change the afp to smb.

drummer21scum
Feb 6, 2008, 02:40 AM
worked at treat! thanks, not to be a bit greedy but you wouldnt know how to add the share to the finder sidebar after it opens, would you? cos for some reason in leopard when u connect to a share its not mounted on the desktop or finder for some reason? strange

jeremy.king
Feb 6, 2008, 09:21 AM
You can show volumes on the desktop by going to Finder Preferences and under the General Tab click the Connected Servers check box. To add the volume to the devices list, you can drag the now visible drive from the finder desktop into the list of devices in a finder window, and everytime you reconnect it should show up in the list.

satyam90
Feb 8, 2008, 03:44 AM
tell application "Finder"
open location "afp://username:password@hostname/sharename"
end tell



Will the above script work only for windows 2003 server? What script I have to use if I want to connect to Windows XP or Linux/Unix machine?

itsallinurhead
Feb 8, 2008, 04:12 AM
Will the above script work only for windows 2003 server? What script I have to use if I want to connect to Windows XP or Linux/Unix machine?

I thought you wanted to use "smb://...." if you were connecting to a windows shared drive?

satyam90
Feb 9, 2008, 03:35 AM
How about connecting to Linux/Unix systems???

jeremy.king
Feb 9, 2008, 03:16 PM
How about connecting to Linux/Unix systems???

The protocol is determined by how you are sharing. Are you using Samba? NFS? Apple File Sharing?

tjwett
Feb 9, 2008, 11:09 PM
you can also just add the volumes to the Login Items in the Accounts pane of System Preferences. if the authentication to the share is stored in the keychain it will automount.

aLoC
Feb 9, 2008, 11:16 PM
you can also just add the volumes to the Login Items in the Accounts pane of System Preferences. if the authentication to the share is stored in the keychain it will automount.

Yes, that is the easiest way, just one drag and drop operation.

Open System Preferences, click on Accounts, click the Login Items tab, and drag and drop the disk icon from your desktop to the login items.

jeremy.king
Feb 11, 2008, 11:55 AM
Yes, that is the easiest way, just one drag and drop operation.

Open System Preferences, click on Accounts, click the Login Items tab, and drag and drop the disk icon from your desktop to the login items.

But what do you do if the drive isn't available or disconnects?

brguitarist
Feb 11, 2008, 07:54 PM
thanks for the useful thread...
simple question though, both through applescript and login items, when the drives mount, a finder window pops up with that drive selected.
since i'd be mounting 3 drives i was wondering if you guys know how to keep those windows from popping up

hmmfe
Feb 11, 2008, 08:09 PM
thanks for the useful thread...
simple question though, both through applescript and login items, when the drives mount, a finder window pops up with that drive selected.
since i'd be mounting 3 drives i was wondering if you guys know how to keep those windows from popping up

I use an automator script and the share is mounted but a finder window does not open. Would think I'd behave just like applescript...? Oh well, automator works well for me.

jeremy.king
Feb 11, 2008, 08:14 PM
thanks for the useful thread...
simple question though, both through applescript and login items, when the drives mount, a finder window pops up with that drive selected.
since i'd be mounting 3 drives i was wondering if you guys know how to keep those windows from popping up

tell application "Finder"
mount volume "afp://user:pass@server/sharename"
end tell

This seems to not pop up the window and probably a better way to mount the share. :)

brguitarist
Feb 11, 2008, 08:27 PM
Cool, thanks kingjr3