Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

6 Answers 6

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

share|improve this answer
    
Good thought, but I already tried it with the same result. –  DCookie Jan 4 '10 at 5:59

Just a tip for anyone struggling with Windows 7 vs. Samba setups:

http://makingwindowseasy.com/2009/12/23/fixing-windows-7-samba-issues/

Although this doesn't seem to be exactly the same problem.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
    
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 '10 at 14:50

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.

share|improve this answer
    
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 '10 at 18:46
    
Appreciate the input. –  DCookie Aug 6 '10 at 18:46
    
Are you using the same user account on all machines? –  Matt Aug 9 '10 at 19:48
    
Yes, the same account. –  DCookie Aug 12 '10 at 14:49

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.