Auto mount your iDisk at startup

Feb 07, '02 09:40:02PM

Contributed by: Anonymous

[Editor's note: The following tip has not been tested, and it makes some assumptions about your knowledge of the Terminal, so it may not be applicable to everyone. Still, I thought it was interesting enough to post...]

There is probably an easier way to do this (maybe an applescript app?), but I wanted to have my iDisk mount when the computer starts up. I wanted this in case the machine reboots at home since I serve a few things to my iDisk. iDisk uses the mount_webdav program to do its thing, but it is not clear what all the stuff means in a ps listing.

For example, when I mount an iDisk using the Finder, I see

  mount_webdav -a10 http://idisk.mac.com/xyz /Volumes/xyz
(xyz = iDisk user name). The -a10 is a file descriptor where keychain data comes from. The http://... is the URL to the idisk, and the /Volumes/xyz is the directory where it will be mounted. If you then use terminal and omit the -a10 you get one or more dialog boxes asking for a username/password.

To make this automatic, you need to manually create the mount directory, then you need to feed mount_webdav your username and password in the form it wants. The format of the username/password is a pair of 4 byte length - characters structure. For example, if my username is xyz, and password is mypass, I must send:
^@^@^@^Cxyz^@^@^@^Fmypass
^@ is control-at, or a null - zero decimal, ^C is control-c or 3 decimal, etc. (in emacs, doing control-q control-c inserts a control-c, control-q control-space inserts a null). Once you have this in a file or coming out of a program, you can just do:
cat mypass | mount_webdav -a0 http://idisk.mac.com/xyz /Volumes/xyz
to mount the idisk since 0 is stdin.

Create a shell script so that /Volumes/xyz is created, then using dropscript, you have an app that will mount the iDisk. But DropScript is designed to take a parameter, so assign any document to open with the generated dropscript-idisk and add that to the Login startup tasks. That document will run the script, and the iDisk will mount.

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020207214002198