The Samba-Bugzilla – Bug 10164
smbclient tar command missed remote directories,files
Last modified: 2018-08-28 07:15:42 UTC
Also seen in 3.6.9, I built 4.1.0rc3 to verify on a recent version.
When trying to replicate directories on Windows 7 machines onto Ubuntu directories and files are missing. Specifically within the following set, directory Pictures is fetched for user Daniella, but not for users Gerben and Gerben2.
smbclient \\\\mssql01\\Users -U backuppc%xxxxxxxxxx -E -d1 -TcX backup3.tar ./Gerben/AppData ./Gerben2/AppData ./Daniella/AppData ./Default/AppData > log3.txt 2>&1
Checking the tarfile just does not provide the directory for either Gerben or Gerben2. The logfile does not name this directory for those users (not even with -d10).
My guess building the file list within the tar command drops items.
When browsing the share interactively (smbclient \\\\mssql01\\Users -U backuppc%xxxxxxxxxx) the directories are shown, the directories can be accessed.
Probably due to NTUSER.DAT, and the fact that users were logged on to the Windows machine. When logged on file NTUSER.DAT is opened and blocked for access by any other program. When examining the logfile I could find a message (NT_STATUS_SHARING_VIOLATION) related to this file. Any files/directories following this file (alphabetical order) is voided, the parent directory is shown with the same message as the file (NT_STATUS_SHARING_VIOLATION).
The error should not be progressed to the parent directory, the directory should be continued to process.
Extract from the logfile:
NT_STATUS_ACCESS_DENIED listing \Gerben2\My Documents\*
NT_STATUS_ACCESS_DENIED listing \Gerben2\NetHood\*
NT_STATUS_SHARING_VIOLATION opening remote file \Gerben2\NTUSER.DAT (\Gerben2\)
NT_STATUS_SHARING_VIOLATION listing \Gerben2\*
NT_STATUS_ACCESS_DENIED listing \Public\*
tar: dumped 396 files and directories
1. I created same samba-share structure as yours. Added a file inside each share as well
# find /share/
2. Accessed Daniella/AppData/file-Daniella from Windows Client
3. created tar using smclient and then looked at contents of tar.
# smbclient \\\\localhost\\myshare -E -d1 -TcX backup3.tar ./Daniella/*
Enter WORKGROUP\root's password:
tar:717 Total bytes received: 0
[root@<> test]# ls -ltr
-rw-r--r-- 1 root root 7168 Aug 28 12:38 backup3.tar
[root@<> test]# tar -xvf backup3.tar
This is my share definition for testing.
workgroup = WORKGROUP
security = user
map to guest = Bad User
passdb backend = tdbsam
path = /share
browsable = yes
guest ok = yes
read only = no
create mask = 0755
This means how smbclient works is:
a. When you want to create tar of all content Provide *
b. if nothing is specified, it creates tar of all content present in smb share.