smbget does not accept -u/p/w options with -R: ----- samba32a:/home/local/Work/samba-3.3.4/source# /usr/local/samba/bin/smbget smb://w2k8srv1/temp/ -w w2k8ad1 -u administrator -p password -R Using workgroup w2k8ad1, user administrator Can't open directory smb://w2k8srv1/temp//Samba: Permission denied Can't open directory smb://w2k8srv1/temp//TE: Permission denied You don't have enough permissions to access smb://w2k8srv1/temp//test1.txt You don't have enough permissions to access smb://w2k8srv1/temp//test2.txt You don't have enough permissions to access smb://w2k8srv1/temp//test3.txt You don't have enough permissions to access smb://w2k8srv1/temp//test4.txt samba32a:/home/local/Work/samba-3.3.4/source# /usr/local/samba/bin/smbget smb://w2k8srv1/temp/test1.txt -w w2k8ad1 -u administrator -p password Using workgroup w2k8ad1, user administrator smb://w2k8srv1/temp/test1.txt ----- Thus "smb://w2k8srv1/temp/test1.txt" works but "-R smb://w2k8srv1/temp" does not work.
# /usr/local/samba/bin/smbget smb://administrator:password@w2k8srv1/temp -R The above command works well
Still not fixed at Samba 3.5.4.
Seems to be related to the USER environment variable, ref https://bugzilla.samba.org/show_bug.cgi?id=8400
on samba 3.6 This issue could still be reproduced. It is not related with the USER environment at all. I could download the file like this: smbget --workgroup=AP -R -u xxx -p xxx smb://locmirror/PATH/file.zip But it failed to work like this smbget --workgroup=AP -R -u xxx -p xxx -R smb://locmirror/PATH No matter I add the --keep-permissions arg or not, it still not work.
This issue is now a well known issue for samba, even the man page of Ubuntu already lists this: http://manpages.ubuntu.com/manpages/natty/man1/smbget.1.html: BUGS Permission denied is returned in some cases where the cause of the error is unknown (such as an illegally formatted smb:// url or trying to get a directory without -R turned on).
4.1.17 has this the same "permission" problem. smbget -r -R smb://user:pass@host/C/share transfers files successfully. Basically if -u and -p are used then the "permission" problem shows. If the user/pass is passed in as part of the URI/SMB:// then all is ok.
Created attachment 11753 [details] possible patch This patch helps in my testing. Can you give it a try?
*** Bug 8400 has been marked as a duplicate of this bug. ***
Created attachment 11798 [details] Patch for 4.3.x and 4.2.x with cherry-pick information
Comment on attachment 11798 [details] Patch for 4.3.x and 4.2.x with cherry-pick information LGTM
Karolin, please add the patch to the relevant branches. Thanks!
(In reply to Andreas Schneider from comment #11) Pushed to autobuild-v4-[2|3]-test.
(In reply to Karolin Seeger from comment #12) Pushed to v4-3-test, re-trying autobuild-v4-2-test
(In reply to Karolin Seeger from comment #13) Pushed to all branches. Closing out bug report. Thanks!