3

I've got a Windows 7 Ultimate system which maps a Samba 3.0.33 share. I have no problems reading, writing, or replacing any files or directories from windows file explorer. I have attempted to set up a push/pull sync script on the windows client using xcopy. I am trying to replace any files newer than the corresponding file/directory in either direction. The copy from the server to the client works great. The copy from the client to the server fails with "access denied" (when the directory already exists - new directories can be created without issue).

This is my windows script:

xcopy c:\source_dir z:\dest_dir /D /E /I /F /R /Y
xcopy z:\dest_dir c:\source_dir /D /E /I /F /R /Y

Here's what I see for the first command:

C:\Source_dir>xcopy c:\Source_dir\test z:\Dest_dir\test /E /I /F /R /Y
Access denied
Unable to create directory - Z:\Dest_dir\test
0 File(s) copied

The same command works fine on an XP system connected to the same server. There must be something I'm missing - any ideas what it might be?

Thanks!

PS: I forgot to mention that if the directory does not exist already on the server, the xcopy command to the server succeeds.

PPS: Robocopy yields identical results.

5 Answers 5

1

I would suggest switching to robocopy since xcopy /? says "NOTE: Xcopy is now deprecated, please use Robocopy."

1
  • Good thought, but I already tried it with the same result.
    – DCookie
    Jan 4, 2010 at 5:59
1

Noticed that new directories were backed up okay and that the listed owner and group was different than the older directories and files. Solved my XP to Samba share permission issue by changing the owner and group. Backup xcopy running fine now!

xcopy d:\mypict~1\* \\linuxserver\backups\homestud\mypictures /mschiy

Was giving

Access denied
Unable to create directory - \\linuxserver\backups\homestud\mypictures\2002

even with no needed files there. When I chmod that 2002 directory to nobody and nogroup - it would get past that dir error! So then I reapplied recursively all files and folders.

0

Make sure that the account you connect with has permission on the server side to create directories Z:\Dest_dir\

mkdir z:\Dest_dir\test creates the same result?

As said above, i'd check the permissions on the server side.

1
  • Mkdir yields "directory already exists". I know I have permissions to create directories, because the commands succeed if the directory is not there.
    – DCookie
    Jan 4, 2010 at 14:50
0

Sorry to resurrect a question from the dead, but I would guess that you need to take a look at your create mask in your samba settings. The default is 755, so if your user account is not the owner of the directory then any new directories or files you create will not be writable by that account. The root directory probably has more permissive unix file permissions, perhaps 775, which is why you're able to create new files and directories in the first place.

4
  • Why apologize? I still haven't figured it out, so I'll double check the settings. However, why does this only occur on Win7 systems? XP works fine, remember...
    – DCookie
    Aug 6, 2010 at 18:46
  • Appreciate the input.
    – DCookie
    Aug 6, 2010 at 18:46
  • Are you using the same user account on all machines?
    – Matt
    Aug 9, 2010 at 19:48
  • Yes, the same account.
    – DCookie
    Aug 12, 2010 at 14:49
0

I also ran into this issue (Win 7 and 8) with robocopy and xcopy failing with error messages indicating failure to create folders, whereas copying via explorer or copy still worked.

I was able to get this working by using the following config options:
force create mode
force directory mode

Specifically 0774 and 0775 in my setup. Apparently something is going haywire with permissions when robocopy or xcopy were being used. This does seem to indicate some sort of configuration issue, and this solution is rather indiscriminate, but that's all I can figure out for now.

Server is FreeNAS 9.2.1.3 running Samba 4.1.6

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .