[Samba] smbclient mask command seems not to work the same way with recurse ON for mget and mput

LPC DPG lpcdpg at gmail.com
Fri Aug 21 10:25:11 UTC 2020

Dear folks.

I am using smbclient 4.2.10 version (the one packaged for OEL 6,
samba4-client-4.2.10-15.el6.x86_64), and observing a weird behaviour of the

I've got a Linux local directorio, say /tmp/eraseme, with a couple of
subdirectories in it, say a and b, each one containing a dummy file, say
a/AM.xls and b/AT.xls

If I run:
smbclient -d 30 -l /var/log/samba -m SMB3 -W "${d}" -U "${u}" "${s}" "${p}"
smb: \> lcd /tmp/eraseme
smb: \> recurse
smb: \> prompt
smb: \> mask *M.xls
smb: \> mput *

it transfer both AM.xls an AT.xls files, which seems not to agree what man
page states:

"       mask <mask>
           This command allows the user to set up a mask which will be used
during recursive operation of the mget and mput commands.

           The masks specified to the mget and mput commands act as filters
for directories rather than files when recursion is toggled ON.

           The mask specified with the mask command is necessary to filter
files within those directories. For example, if the mask specified in an
           mget command is "source*" and the mask specified with the mask
command is "*.c" and recursion is toggled ON, the mget command will retrieve
           all files matching "*.c" in all directories below and including
all directories matching "source*" in the current working directory.

           Note that the value for mask defaults to blank (equivalent to
"*") and remains so until the mask command is used to change it. It retains
           the most recently specified value indefinitely. To avoid
unexpected results it would be wise to change the value of mask back to "*"
           using the mget or mput commands."

Nonetheless, if I do it the other way around,

smbclient -d 30 -l /var/log/samba -m SMB3 -W "${d}" -U "${u}" "${s}" "${p}"
smb: \> lcd /tmp/eraseme
smb: \> recurse
smb: \> prompt
smb: \> mask *M.xls
smb: \> mget *

, mget does seem to honour the referred description, downloading only
AM.xls file to Linux.

I have been looking in Google, but have seen no reference to similar
problems. I do assume hence whether I am doing something wrong, or
misinterpreting the manual, then I can't get it working.

So I'd be really grateful if any of you who might have ever faced something
similar could share the experience, as I am really lost with it.

Thanks so much in advance. Best regards.

More information about the samba mailing list