Not able to copy files to another Mac in the network via AFP

afpfile-sharing

I have an iMac and an MBP connected to the same network and I want to transfer files from one machine to the other. I can see the other device listed in my Finder sidebar and connect to it from there. I am able to view the remote files as well. However, when I try to copy files to the remote machine, it doesn't work. When I try to copy, Finder creates a file with the same name but zero bytes in size. It then warns me that a file with the same name exists and do I wish to replace it. On confirming replace, I get the following erorr:

The operation can’t be completed because an item with the name “” already exists.

I checked the remote machine and see that empty file which just got created remains there with zero bytes size. What could be wrong?

A few more points:

  • I have the same user account present on both the machines and I am logging in with that credentials.
  • I am the owner of the target folder and my account has got write permissions. I have also tried to CHMOD the folder and contents to 777.
  • One machine runs Lion and the other Snow Leopard. However, I was getting the same error with two Snow Leopards as well.

Any help will be much appreciated.

Best Answer

It turned out that the issue was indeed different UIDs though the usernames were the same.

From the Apple Support Communities link:

borbye:

The first user that is established on an OSX disc is given UID number 501. Normally next user is given UID 502. In my case I could not import my existing user during first run with my new MB Air. Had to establish a testuser and later import my existing user. It turned out that the testuser was giver UID 501 and my existing user was given UID 502. Result was the existing users on the two macs are not the same even thoug the username and login is identical..

I tried what was suggested in the support thread and screwed up my entire system - as he had clearly warned.

borbye:

Check your users in systemprefs -> accounts - open the lock and right click on user -> choose advanced options.

NB: Dont even think you can just change the UID for the user and it will work..... If some more advanced users have a script to change the UID for all files in a home folder, please let us know..

The workaround suggested at the thread didn't quite work for me. But I am not sure if I missed any steps. So you can try this at your own risk.

one51mac:

borbye is correct that this will remedy the problem but there is a way to do it and have your account work. after changing the user UID and group UID to 501 you will have to restart. then when you log on your home folder will still be your default but you will not have any access. Since you are still an admin you can change that. right click on the home folder and select get info click arrow for sharing and permissions. Your old UID account will show up as _unknown delete this user and add your user to it giving yourself read and write privilege. click on the cog on the bottom and select apply to enclosed items. A warning box will appear stating that this process cannot be undone do you wish to proceed? click yes and a status bar will come up. once the bar is gone the process is complete. since you didn't have access to your home folder you cannot save your settings, this is a good thing since your account will not look remotely the same as yours most likely. all you have to do now is logout and then back in. Your account will look as it did before the change with all the access settings and so forth as before the change... minus some permissions due to the overwrite. It's a minor repair to the permissions to some shares considering you will be able to now move files to and these shares without the permissions alert that only creates a 4kb file instead of the real thing. Takes 5 minutes at most. Have fun.

Ended up doing a fresh install and created a user with the same username as the first one. It took a lot of time to backup and restore all the data but finally I am back on track.