[AppleScript] Mounting Network Shares...


Recommended Posts

Okay I have written an applescript that connects to a Windows 2003 server. However, I'd also like it to connect to the Linux server, and can't figure out how to accomplish this... this is what I'm using:

mount volume "smb://user:pass@server/share"

I have alot of other error handling and what not in there as well, but this is the line that's not working for the Linux server. It's a Redhat server. How would I go about automating the connection to the shares just like I have for the Windows server?

Link to comment
Share on other sites

Heh, I also have this problem. I tried writing an applescript to connect to a linux server as well...

tell application "Finder"
mount volume "smb://user@server/share"
end tell

The above code doesn't seem to work for me. I can connect using "Connect to server..." just fine though...

Link to comment
Share on other sites

same here, but the point is to automate this for employees...  it's easier for them, AND it makes my life easier ;)

ANYBODY!!!  PLEASE!!!  *Begs*

584773051[/snapback]

it depends on how you are sharing things on the linux box.

if the Linux box is using NFS to share folders, you have to make sure that the connecting system is able on the list of allowed hosts. After that on OSX the cmd line command is:

mount -t nfs <machine name or IP>:<full path to share (/usr/bin)> /mount/point

if you are sharing files using samba, it should be the same as mounting the win2k3 server shares

As a side note, finder supports NFS -- just go:

option-k:  nfs://<machine name or IP>/full/path/to/share

Link to comment
Share on other sites

it depends on how you are sharing things on the linux box.

if the Linux box is using NFS to share folders, you have to make sure that the connecting system is able on the list of allowed hosts. After that on OSX the cmd line command is:

mount -t nfs <machine name or IP>:<full path to share (/usr/bin)> /mount/point

if you are sharing files using samba, it should be the same as mounting the win2k3 server shares

As a side note, finder supports NFS -- just go:

option-k: ?nfs://<machine name or IP>/full/path/to/share

584783008[/snapback]

Oops, missed that you want to automate the process -- you can have the network drives automount.

check out here: http://www.macosxhints.com/article.php?sto...query=automount

or here: http://www.macosxhints.com/article.php?sto...query=automount

Link to comment
Share on other sites

Just as a side note, if you want to automatically mount a network share when you login, just manually mount the share and then drag its icon into your statup items box (in your accounts preference pane).

Link to comment
Share on other sites

The way I work with shares myself:

Created Internet Locations shortcuts in a folder on my HD.

Dragged that folder into my Dock.

When I want to use a share, I just right-click the Dock folder, and choose the share I want. It mounts automatically, without asking for a password.

To create Internet Locations shortcuts, u just type the url, including the user+pwd, into a text editor, then Command-Drag it to the desktop / folder you want it in.

Example url:

smb://User%20Name:password@192.168.0.1/e$

I must say, this is quite handy if you don't like having 6 shares always mounted on your desktop all the time.

post-53893-1098634038.jpg

Link to comment
Share on other sites

  • 4 weeks later...
Heh, I also have this problem. I tried writing an applescript to connect to a linux server as well...

tell application "Finder"
mount volume "smb://user@server/share"
end tell

The above code doesn't seem to work for me. I can connect using "Connect to server..." just fine though...

584771201[/snapback]

This works fine for our Linux shares (thanks for the tip). I suspect there may be some WINS issues with mounting SMB shares. I've found using the full DNS-registered internet address of the server (or the IP address) works all the time whereas using just the short name can fail at times.

e.g. smb://user@server.domain.com/share

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.