To mount one or more volumes from an afp server you can do the following:


1) with AppleScript (Classic MacOS/MacOS X):

   The syntax to mount a Volume with AFPoverAppleTalk is

       mount volume "[vol]" on server "[Servername]" in AppleTalk zone ¬
           "[zone]" as user name "[user]" with password "[passwd]"

   For use with AFPoverTCP you have to supply an AFP URL:

       mount volume "afp://[user]:[passwd]@[ip address]:[afp port]/[vol]"

   or similar

       mount volume "afp://[ip address]:[afp port]/[vol]" ¬
           as user name "[user]" with password "[passwd]"

   Notes:

   - Standard Additions 1.4 - 1.4.2 had problems with some non Apple AFP-
     servers that don't support encrypted passwords -- fixed with 1.4.3
     and above. (see this technote and this summary for details)
   
   - in 1.7 for MacOS X the AFP over AppleTalk syntax 'on server [servername]' 
     didn't work, so you should use the AFPoverAppleTalk syntax: 'mount volume 
     "afp:/at/..." (see above for an example)
     
   According to the AppleScript Sourcebook the two following problems exist:
   
   - "In Mac OS 9.1, none of the commands in Standard Additions worked if the
     new Security items in the Extensions folder were disabled. This bug bit
     many users who routinely disabled the Security items because they did not
     use the Keychain and felt secure enough without the extensions. In both
     the Classic environment of Mac OS X and the new 1.6 release of Standard
     Additions for Mac OS 9.1, only the Mount Volume command in Standard
     Additions requires the Security items."
   
   - "AppleScript 1.6 introduces a known problem with using the mount volume
     command to mount volumes hosted on certain kinds of servers, especially
     Windows 2000 machines. This problem will be addressed in a future version
     of AppleScript"
  
  
2) From the terminal in MacOS X the situation is different as you have to
   create a mountpoint first (eg. with "mkdir /Volumes/test")

       /sbin/mount_afp 'afp://[user]:[passwd]@[ip address]:[afp port]/[vol] \
           /Volumes/test'

   If you want to do the initial connection with AppleTalk, then it will look 
   like:

       /sbin/mount_afp 'afp:/at/[user]:[passwd]@[Servername]:[zone]/[vol]' \
           /Volumes/test'

   Note 1: Even if you want Mac and server to speak via AppleTalk, the 
           connection will be established via AFPoverTCP, if the server 
           supports this. So  only the service location will be done
           via AppleTalk in the latter case.

   Note 2: Never ever use the "[user]:[passwd]@" syntax inside the Finders 
           "connect to server" dialog box, as this will leave some kind of 
           alias inside your home directory ("Library/Recent Servers/") 
           from where both username and passwort can be read in cleartext! 
           Use this only in the shell...
           [This problem seems to be solved with MacOS X 10.2]
           
   Note 3: If you want to mount a volume as guest, you have to supply the right
           UAM (User Authentication Method) in an AFP URL -- in this case 
           'No User Authent':
           
               afp:/at/;AUTH=No%20User%20Authent@[Servername]:[zone]/[vol]
               
           BTW: You can get the list of UAMs a server supports by using 
                asip-status.pl by James W. Abendschan (or use this fixed
                version, that is able to display the afp server flags 
                correctly). For querying the server from MacOS 7.x - 9.x 
                machines, you can also use ServerInfo by Anders Ulfheden.

   Note 4: If you want the mounted disk to appear on the desktop, run 
           '/usr/sbin/disktool -r' before and after the mount itself.
           [Not necessary any more with MacOS X 10.2]

   Note 5: If you want to see a lot of debug messages while connecting then
           type "setenv AFP_DEBUG_LEVEL 8" before
           [This doesn't work any more under MacOS X 10.2 and above]
           
   Note 6: To generate proper AFP URLs you can use tools freely available
           on the net: http://www2.opendoor.com/asip/afpurlgenerator.html
           
3) In MacOS X you can also create an AFP URL (including logon credentials or
   not) and send this via an open event to the system, e.g. by the following 
   line:
   
   open "afp://;AUTH=No%20User%20Authent@afp.opendoor.com/OpenDoorPublic"
   
   (this should work in HTML pages as well -- just click the URL above to see 
   how this works in MacOS X)
   
4) Creating AFP URL 'bookmarks' is straightforward. Just create a file with
   the suffix '.afpurl' and put the complete AFP URL inside, e.g. by 
   echo "afp://afp.opendoor.com/OpenDoorPublic" > just_another.afpurl
   
   The Finder will display the URL with a volume icon and the volume's name

5) For startup mounting you can use AFP Automount by Digital Specter.

6) You might also place AFP URLs (see .afpurl above) or aliases of servers in 
   your 'Login Items' (inside Preferences)

7) If you have to mount AFP servers before a person logs in, then you might 
   want to try an AFP automounter StartupItem, that reads a configuration file 
   (/etc/AFPVolumes containing pairs of AFP URLs and mountpoints) and mounts the 
   servers at the specified mountpoints.

Some remarks: 

- [ip address] can also be substituted with a FQDN (fully qualified domain
   name) that must be resolvable by the Mac, that wants to mount the share.

- [afp port] defaults to 548 and can be omitted if the server uses this 
  default port

- [zone] defaults to "*" (aka the default zone). If you have real zones than 
  you should use the name of the appropriate one.

- In [vol] special characters need *not* to be quoted within an AFP URL if 
  used by the ScriptEditor. But with MacOS X's CLI tool the situation is 
  different: If your Volume is named "my backup" then you should substitute 
  with "my%20backup" or "my\ backup" (the latter without quotes around)
  See also the AFP URL generator
  

Thomas Kaiser, 2001/12/26 (updated 2003/02/28)

-- please feel free to send comments and corrections to me --