Mount shared drives with different users

afpapplescriptmountnas

I have a Mac (Sierra with 1 user account) and a Synology NAS (DSM 6.0 with 2 user accounts), and I'd like to mount shares for both accounts on my Mac. So I wrote that script (and set it as startup item):

try
    delay 5
    mount volume "afp://user1:pass1@nas.local/Share1"
    mount volume "afp://user2:pass2@nas.local/Share2"
end try

Problem is, the first mount command works, but not the second (whatever the order of the lines), as if there were only one AFP user allowed at the same time. The error message is (approximately translated):

Connexion to nas.local server failed.

Share doesn't exist on the server. Check the share name, then retry.

Looks like the first user is used for the second mount command.

I don't think it's an AFP limitation (is it?), so there may be another way to mount those shares?

Best Answer

You can't login to the same Netatalk (AFP)1 server with two different sets of credentials. This is why you are are seeing the result you are seeing.

When you log into AFP server, there is a 1:1 relationship between the client and the server. This is why your client is able to browse and find all of the available shares under that login. It won't allow you to log in again because you would have to break the existing connection first. However, you can log into a different AFP server.

This is also why Fast User Switching doesn't work when your home directories are stored on the network.

You have two options to resolve this:

  1. Make the shares/resources available to the user you want to log in with (Recommended)

  2. Create another Netatalk server instance. It can be another physical server or a sandboxed server.


1 From Wikipedia (AFP): A few NAS solutions support AFP mostly by means of Netatalk: LaCie EtherNet Disk & 12big (AFP 3.3), NETGEAR's ReadyNAS (AFP 3.2), QNAP (AFP 3.x), Synology's Disk Stations (AFP 3.1), ... being commercial examples and FreeNAS and napp-it (which use Netatalk) being free software examples.