[Samba] Cannot list directory with smbclient

Marco listaddr at gmail.com
Mon Mar 24 09:27:09 MDT 2014

I'm using BackupPC to back up a windows server 2008 R2 machine using smb
(which invokes the smbclient program).

I'm aware that junction points give errors during the backup as in

NT_STATUS_ACCESS_DENIED listing \Documents and Settings\*

but I'm fine with that. The problem I'm having is not about a junction
point, but with a normal directory. This directory is not being backed up,
and in the xfer log I see:

                directory \shared\
NT_STATUS_ACCESS_DENIED listing \shared\*

BackupPC uses the following command to connect:

/usr/bin/smbclient \\server.example.com\k -A .smbc -E -d 1 -c tarmode\ full
-Tc -

However, connecting interactively with smbclient using the same command
line that BackupPC uses (minus the tarmode invocation), it works perfectly

$ smbclient '\\server.example.com\k' -A .smbc -E -d 1
Domain=[EXAMPLE] OS=[Windows Server 2008 R2 Standard 7601 Service Pack 1]
Server=[Windows Server 2008 R2 Standard 6.1]

smb: \> ls \shared\*
      D        0  Mon Dec 16 14:31:30 2013
  ..                                  D        0  Mon Dec 16 14:31:30 2013
  .DS_Store                          AH     6148  Fri Oct 15 05:48:24 2010
  Act                                 D        0  Thu Dec  5 17:30:29 2013
...[rest of files]...

                37119 blocks of size 4194304. 10873 blocks available

The file .smbc has the following contents:

username = administrator
password = XXXXXXX
domain = example.com

So I'm connecting as user administrator, and as administrator I can also
perfectly browse this directory when logged on (as administrator) directly
on the machine.  The directory has of course full permissions for the
administrator user.

When seeing the directory in windows file manager the folder icon has a
small lock on it (the directory is shared), although as I said I can enter
it and browse its files and subdirectories perfectly fine.

I'm not sure it's a smbclient problem, but I'm asking here since I haven't
been able to find relevant information.
Thanks for any help.

More information about the samba mailing list