[Samba] Smbclient With Tarmode and Excludes

Christian Völker cvoelker at knebb.de
Thu Aug 21 10:13:50 MDT 2014

Hash: SHA1
Hi all,

I just noticed a strange behavious of my smbclient which came up on
debugging BackupPC.

I have set up a AD Domain with an windows Server as DC. In this domain I
have a laptop running which I try to backup.

On the laptop I created a share called "C" and assigned access
permissions for the user called "backuppc".

I want to exclude some directories and files from the backup so I use
excludes. Initially I was unsure about the syntax and I found a bug
report to this:

Now I used the following command line to perform the backup:
smbclient \\\\christian.knebb.de\\C "xxxxx" -U backuppc  -E -d 2 -c
tarmode\ full -TcrX - "\Apps"  >/bu.tar

In contrast to the above mentioned bug report smbclient does *NOT*
exclude the directories! I have to use wildcards to get this:
smbclient \\\\christian.knebb.de\\C "xxxxx" -U backuppc  -E -d 2 -c
tarmode\ full -TcrX - "\Apps\*" >/bu.tar

Now I tried to exclude a single file from backup as follows:
smbclient \\\\christian.knebb.de\\C "xxxxx" -U backuppc  -E -d 2 -c
tarmode\ full -TcrX - "\Apps\*" "\hiberfil.sys" >/bu.tar

Unfortunately smbclient always tries to backup the file- which is
obviously always locked and thus smbclient aborts:
NT_STATUS_SHARING_VIOLATION opening remote file \hiberfil.sys (\)
tar: dumped 84 files and directories
Total bytes written: 12719104

My questions:

1. What is the correct syntax to exclude a single file?

2. Will someone possibly reopen the above bug and document the correct
usage (with asterix) for directories?

3. Is there a way to tell smbclient to skip the file in case of error
instead of aborting?

Tested on CentOS5/32 (samba 3.6.6)  and CentOS6/64 (samba 3.6.9)

        workgroup = MYDOMAIN
        server string = Samba Server Version %v
        unix charset = UTF8
        password server =
        realm = LOCAL.MYDOMAIN.DE
        security = ADS
        encrypt passwords = yes
        winbind use default domain = true
        load printers = yes
        cups options = raw
        comment = Home Directories
        browseable = no
        writable = yes
        comment = All Printers
        path = /var/spool/samba
        browseable = no
        guest ok = no
        writable = no
        printable = yes

Any clue?



Version: GnuPG v2.0.17 (MingW32)

More information about the samba mailing list