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

Auto mount your iDisk at startup Network
[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.
    •    
  • Currently 1.00 / 5
  You rated: 1 / 5 (5 votes cast)
 
[26,618 views]  

Auto mount your iDisk at startup | 13 comments | Create New Account
Click here to return to the 'Auto mount your iDisk at startup' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
iDisk Mounting
Authored by: Earl on Feb 08, '02 06:08:26AM

I think there's a better way using mount_afp. AFAIK, afp encodes passwords whereas webdav does not (at least on 10.1.x) although I've heard that may change.

As you said, create a mount point, and open it:
mkdir /Volumes/earl
chmod 777 /Volumes/earl

Now, just do a mount:
mount_afp afp://earl_dombroski:not_in_public@idisk.mac.com/earl_dombroski /Volumes/earl

That is,
mount_afp [-o option1[,option2...]]
afp://[username:password]@rhost[:port]/volume node

Although, I haven't figured out the options yet...



[ Reply to This | # ]
iDisk Mounting
Authored by: Earl on Feb 08, '02 07:16:45AM

OK, the options aren't important!

If you put the thing in a *visible* folder, and give the mount point the same name as the original, then it shows up in the finder!

So, my command should've been for /Users/Shared/earl_dombroski



[ Reply to This | # ]
iDisk Mounting
Authored by: Earl on Feb 08, '02 07:24:04AM

My confusion - trying too many things at once. The name doesn't matter, just so long as you've created a NOT hidden directory.

You can't eject from the finder though - in use error is given. You must "umount" from the terminal.



[ Reply to This | # ]
iDisk Mounting
Authored by: fridberg on Feb 09, '02 08:44:22AM

Actually, to make volume visible on desktop, just run

disktool -r

Mike.



[ Reply to This | # ]
Other ways; afp
Authored by: pecosbill on Feb 08, '02 06:49:41PM

Although I can't verify this (OS 8.6 at work), you could also make an alias to the iDisk. put it in your startup Items folder (may have to be created), then put the password to it into the Keychain and set the finder to always have access. The one thing that won't work the same is the alias will force a window to open with the iDisk contents.

The drawback to AFP (apple filing protocol) as other comments stated is the iDisk cannot remain mounted on the machine. Apple has a max connection time.



[ Reply to This | # ]
Other ways; afp
Authored by: jamal on Apr 14, '03 02:41:45AM

Using AppleScript is the easiest way:

tell application "Finder"
open location "afp://[username:password]@idisk.mac.com/[username]"
end tell



[ Reply to This | # ]
Use Applescript to make an app...
Authored by: tz on Feb 10, '02 12:25:59AM

The applescript is just the one line

do shell script "/Users/myname/path-to/idiskauto.sh"

Save that as an application and add that to the things run at login by the login pref pane.

The idiskauto.sh looks like:

#!/bin/sh
sudo rmdir /Volumes/iDisk
mkdir /Volumes/iDisk
cat /Users/myname/idiskunpw | /sbin/mount_webdav -a 0 http://idisk.mac.com/myiToolslogin /Volumes/iDisk

the idiskunpw is the thing with the length/name/password stuff.



[ Reply to This | # ]
Use Applescript to make an app...
Authored by: tweek on Jun 05, '02 08:26:55PM

You can just drag the iDisk to your Login startup items in control panel, and it will open it on log on, without the need to run a script. However as in running the script, it will open a finder window with your iDisk items.



[ Reply to This | # ]
i dont WANT my idisk to automount!
Authored by: Greenfruit on Mar 10, '02 02:48:40PM

i installed broadband, and my idisk has JUST started mounting automatically at startup, not necessarally a problem as i tend to leave the mac on, but anyone know ehy, or how to stop it?

ive searched for the name of my idisk on my mac incase theres an alias somewhere but only one i know of.

i cant find anything in preferencs either.

ideas?



[ Reply to This | # ]
Creating the password file
Authored by: BrianYoung on Jul 03, '02 11:52:42PM

I have tried to create the password file exactly as posted in the original message. It didn't work and I am still asked for a username and password by my Mac. Has anyone else gotten this to work? Please share what you have learned.

Some things are not clear in the original post:

Directions were give to create null characters (^@) and the control-C character (^C). However, the example also shows a control-F character (^F) just before the password. I used emacs and created a file just like the example (with my password and user info). I created the ^F character using "control-q control-f". Is this correct?

Also, is the number of null characters important? The post does not elude to this, but after reading man pages it sounds like the number of null characters should be the same as the number of characters in the username.

Any clarification would be helpful.



[ Reply to This | # ]
Creating the password file
Authored by: Barry Books on Jan 18, '03 09:45:03AM

the format is
32bit number
userid
32bit number
password

so if your userid is fred and password smith the file would contain in hex

0000 0004 6672 6564 0000 0005 736d 6974 680a

or

^@^@^@^Dfred^@^@^@^Esmith

the 0a on the end is a newline



[ Reply to This | # ]
Auto mount your iDisk at startup
Authored by: bmhunt on Oct 18, '06 09:54:53AM
This works for me:

cat ~/webdav_pass | mount_webdav -a0 http://idisk.mac.com/User/Backup ~/iDisk_Backup

The ~/webdav_pass file I created with a perl script which takes 3 arguments: the file, user and password:

#!/usr/bin/perl

$file = shift;
$user = shift;
$pass = shift;

$upack = pack('CCCC',0,0,0,length($user));
$ppack = pack('CCCC',0,0,0,length($pass));

open WDF, ">$file" or die "Cannot open $file for writing";
print WDF $upack, $user, $ppack, $pass;
close WDF;
I don't know how to mount the root of the iDisk directory. I was quite happy to just get this.

[ Reply to This | # ]
Auto mount your iDisk at startup
Authored by: bmhunt on Oct 18, '06 10:03:19AM
Incidentally, rather than creating a perl script, you can just run it from the command-line, to create the webdav password file, likeso (replacing user and password accordingly):

perl -e 'foreach ("user","password") {print pack("CCCC",0,0,0,length($_)).$_}' > webdav_pass_file

Hope that helps someone.

[ Reply to This | # ]