Mount Shared Drive via AFP in Terminal

I want to mount an external drive, connected on computer A, to computer B.

I am able to access and mount the drive by connecting to the server through Finder (Command-K), but how can I do this exact action through the terminal? I've been using several formats of mount and mount_afp but nothing seems to work. Something along the lines of:

mount_afp -i afp://user:pass@ipaddress/Volumes/SharedDrive /Volumes/Shared

In Finder, I just type the IP of the Mac connected to the drive, input credentials, and mount the selected drive...but it's not working by simply entering the afp://ipaddress, just like the 'Connect Server' command through Finder, in the terminal.

How do I do the same connection with a bash command? The end result will be the mounted drive on B.


A couple of things you need to be aware of.

First - the AFP URL needs to contain the name of the share - not it's location on the server. Second, the mount point must be an empty directory that you have write permission to. So your commands might be :-

sudo mkdir /Volumes/mount
sudo mount -t afp afp://user:pass@ipaddress/SharedDrive /Volumes/mount

Try:

sudo mount -t afp afp://user:pass@ipaddress/user /Volumes/Shared