This took me all morning to find, and I don't want my time to go to waste. If you use smbget -R -u $user -p $password smb://$ip/$share/ and do NOT have the environment variable USER set, (as you won't when running from cron), then you will get an error "You don't have enough permissions to access smb://$ip/$share/$filename" for every file. If you have the USER variable set, it works perfectly. Note that I *am* specifying the username in the commandline, so I can't see any reason to need this environment variable. Discovered in 3.4.0, still an issue in 3.5.8 Things that work/fail: Getting one file without -R works, WITH -R getting a single file OR a directory fails. With the environment variable USER=root works, WITHOUT the environment variable it fails. This works: Domain=[NAS] OS=[Unix] Server=[Samba 3.5.2] This fails: Domain=[BTG] OS=[Windows Server 2003 3790 Service Pack 1] Server=[Windows Server 2003 5.2] Thanks & greets to BaT in #samba-technical for reminding me to check it on a more recent version of smbget.
Looks like a duplicate of https://bugzilla.samba.org/show_bug.cgi?id=6482. Embedding username:password@ into the smb URL seems to be working.
*** This bug has been marked as a duplicate of bug 6482 ***