Connecting to password protected AFP server from terminal?
To mount a share in Terminal use the following commands:

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


This works because the folder /Volumes is world read &amp; writable.

If you use sudo mkdir /Volumes/mount mount has the following permissions:

drwxr-xr-x+ 2 root  admin  -       68  8 Mär 02:40 . &lt;- mount
drwxrwxrwt@ 5 root  admin  hidden 170  8 Mär 02:40 .. &lt;- /Volumes


and the only possible command to mount a share is:

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


because you are not allowed to "write" (=mount) to the folder mount as non-root user.

with the following result:

drwx------  1 root  wheel  -        264  8 Mär 02:38 . &lt;- mount (the share "Desktop")
drwxrwxrwt@ 5 root  admin  hidden   170  8 Mär 02:42 .. &lt;- /Volumes


and you can't even open (=read) the folder with your user.

If you create the mount folder with mkdir /Volumes/mount the permissions looks like this:

drwxr-xr-x+ 2 user  admin  -       68  8 Mär 02:42 . &lt;- mount
drwxrwxrwt@ 5 root  admin  hidden 170  8 Mär 02:42 .. &lt;- /Volumes


After mounting the share with: 

mount -t afp afp://user:pass@ipaddress/Desktop /Volumes/mount


the permissions look like this:

drwx------  1 user  staff  -        264  8 Mär 02:38 . &lt;- mount (the share "Desktop")
drwxrwxrwt@ 5 root  admin  hidden   170  8 Mär 02:42 .. &lt;- /Volumes