Why can't I copy files from a Mac to a samba share?

2

I have a share set up on my Ubuntu 10.04 box, and the Mac can see it, connect to it, and sort of write to it.

When I try to copy a whole tree to the share, I get an error saying "The operation cannot be completed because you don't have access to some of the items". If I zip the directory, and copy that over, it succeeds.

Any explanation?

My smb.conf:

[global]
workgroup = wg
netbios name = ubuntu
security = user

[Wife Debris]
path = /home/wife/wifedebris
read only = no
guest ok = no
force user = wife
force group = wife

Edit:

The tree partially copied over. Each Filename.docx file also has a ._Filename.docx, and each directory that was copied over also has a 0-byte ._Directory file at the same level. Also, each directory that was copied over has a .DS_Store and ._.DS_Store file.

chris

Posted 2010-06-16T00:58:47.220

Reputation: 8 607

1

See this Apple KB article for how to solve part of your problem.

– David Schwartz – 2011-09-24T05:25:53.057

Answers

1

This sounds like potential permissions trouble. There's no default create mask or directory mask set for the share, so you're getting the default permissions masks. These may not be sane defaults (for whatever reason).

Since you can copy whole files, but not directory trees, I suspect your directory mask is off. To check this, run two copy tests:

  1. a directory tree with a few files and/or subdirectories (this copy should fail); and
  2. the same tree compressed into a single archive file (this copy should succeed).

After copying, run ls -l on all the files copied. (SSH into the server if needed.) Check that the server shows sane permissions:

  • files should OK -- they might be rw------- (read/write for owner), and maybe rw-r--r-- or even rwxr-xr-x (read/write/execute for owner).
  • directories need to be rwx------ at least (read/write/execute for owner). if the write bit is missing, you won't be able to create files in the directory; and if the execute bit is missing, you'll end up with situations where processes can't descend into subdirectories or generate directory listings.

If you are missing the execute bit on directories, fix it with the directory mask directive in the share section:

# use these for locked-down, user-only permissions
# 0700 is rwx------, 0600 is rw-------
directory mask = 0700
create mask = 0600

# use these for more open, user-only-write, others-read permissions
# 0755 is rwxr-xr-x, 0644 is rw-r--r--
directory mask = 0755
create mask = 0644

It's also possible you're running into trouble with the force user directive. I'm not very familiar with it, but when it's used, (1) your connection to the server is authenticated through your user, and then (2) operations on the share are performed as the forced user. If you are logging in as user husband and accessing the share under /home/wife/wifedebris, it's possible you're running into trouble with the permissions on either that directory or its parent (/home/wife). Those directories may need to be at least world readable/executable for the server to access them.

quack quixote

Posted 2010-06-16T00:58:47.220

Reputation: 37 382

The copy of the directory tree partially succeeded, and the dirs that were created are 755. I think the force user directive is working, because the newly copied files are owned by the correct user and group. – chris – 2010-06-16T23:23:53.997

@chris: you might test it when opened wide (use directory/create masks of 777) to see if that makes any difference. offhand, tho, it's sounding like not-a-server-permissions problem. anything weird in the source permissions or ownership? – quack quixote – 2010-06-17T01:11:00.013

Don't know - it seems to be failing on a document created by msword, which contains embedded images. Word is not running, and I tried rebooting the mac - experienced the same issue. I'm suspect something to do with the mac resource files - there are some strangely named files and directories - but don't have enough mac background to be certain. – chris – 2010-06-17T11:53:40.407

@chris: me neither, sorry. you might update the question to post those details or others. can you include examples of the directory tree you're trying to copy, especially some of what you'd consider "strangely named"? we probably don't need a whole tree listing, but 5-10 example filenames, and some statistics (how many files, how large overall, etc) would be good. – quack quixote – 2010-06-17T15:30:34.177