The problem occurs always, but only with remote site reporting wrong/broken file permissions:
sftp downloads files with those wrong permissions. The download succeeds, but to access the file, you have to chmod them.
Recursive downloads fail reproducibly.
A workaround for a manual download could be to chmod the directories and try the command again, then chmod the downloaded tree again, try the download again, ... , until the download was successful.
The remote site reports wrong permissions (no permission at all) for each directory and file.
sftp takes these permissions for the download, even when it is not told to do so via option.
As a result the downloaded directories have no write permissions and downloading the contained files fails.
The directory has been created, but with empty permissions, thus downloading the content fails, because the local files/directories could not be created.
mm@janus:~/download/download-test/test $ ll
total 4
d--------- 2 mm mm 4096 Jul 25 13:41 download
mm@janus:~/download/download-test/test $
Expected behaviour:
sftp should use local umask or given umask for creating files and directories.
Only when it has been told to by option, it should set the remote permissions of directories and files, but only after their content has been downloaded, so that local files and directories can be created for download, even when the remote directory does not have write permission enabled.
Thus it could even download and reproduce a directory tree without write permissions.
The problem occurs always, but only with remote site reporting wrong/broken file permissions:
sftp downloads files with those wrong permissions. The download succeeds, but to access the file, you have to chmod them.
Recursive downloads fail reproducibly.
A workaround for a manual download could be to chmod the directories and try the command again, then chmod the downloaded tree again, try the download again, ... , until the download was successful.
The remote site reports wrong permissions (no permission at all) for each directory and file.
sftp takes these permissions for the download, even when it is not told to do so via option.
As a result the downloaded directories have no write permissions and downloading the contained files fails.
sftp> ls -l
d--------- 32 0 0 8192 Sep 25 18:45 download
sftp>
sftp> get -r download/ download/ to download download/ 20140821 download/ 20140826 download/ 20140828 download/ 20140902 download/ 20140903 download/ 20140904 download/ 20140909 download/ 20140910 download/ 20140911 download/ 20140916 download/ 20140917 download/ 20140918 download/ 20140923 download/ 20140925 download/ 20140717 download/ 20140722 download/ 20140723 download/ 20140729 download/ 20140730 download/ 20140731 download/ 20140806 download/ 20140807 download/ 20140812 download/ 20140814 download/ 20140819 download/ 20140820 download/ 20140827 download/ 20140924 download/ 20140929 download/ 20140724
Fetching /home/test/
Retrieving /home/test/download
Retrieving /home/test/
mkdir download/20140821: Permission denied
Retrieving /home/test/
mkdir download/20140826: Permission denied
Retrieving /home/test/
mkdir download/20140828: Permission denied
Retrieving /home/test/
mkdir download/20140902: Permission denied
Retrieving /home/test/
mkdir download/20140903: Permission denied
Retrieving /home/test/
mkdir download/20140904: Permission denied
Retrieving /home/test/
mkdir download/20140909: Permission denied
Retrieving /home/test/
mkdir download/20140910: Permission denied
Retrieving /home/test/
mkdir download/20140911: Permission denied
Retrieving /home/test/
mkdir download/20140916: Permission denied
Retrieving /home/test/
mkdir download/20140917: Permission denied
Retrieving /home/test/
mkdir download/20140918: Permission denied
Retrieving /home/test/
mkdir download/20140923: Permission denied
Retrieving /home/test/
mkdir download/20140925: Permission denied
Retrieving /home/test/
mkdir download/20140717: Permission denied
Retrieving /home/test/
mkdir download/20140722: Permission denied
Retrieving /home/test/
mkdir download/20140723: Permission denied
Retrieving /home/test/
mkdir download/20140729: Permission denied
Retrieving /home/test/
mkdir download/20140730: Permission denied
Retrieving /home/test/
mkdir download/20140731: Permission denied
Retrieving /home/test/
mkdir download/20140806: Permission denied
Retrieving /home/test/
mkdir download/20140807: Permission denied
Retrieving /home/test/
mkdir download/20140812: Permission denied
Retrieving /home/test/
mkdir download/20140814: Permission denied
Retrieving /home/test/
mkdir download/20140819: Permission denied
Retrieving /home/test/
mkdir download/20140820: Permission denied
Retrieving /home/test/
mkdir download/20140827: Permission denied
Retrieving /home/test/
mkdir download/20140924: Permission denied
Retrieving /home/test/
mkdir download/20140929: Permission denied
Retrieving /home/test/
mkdir download/20140724: Permission denied
sftp>
The directory has been created, but with empty permissions, thus downloading the content fails, because the local files/directories could not be created.
mm@janus: ~/download/ download- test/test $ ll ~/download/ download- test/test $
total 4
d--------- 2 mm mm 4096 Jul 25 13:41 download
mm@janus:
Expected behaviour:
sftp should use local umask or given umask for creating files and directories.
Only when it has been told to by option, it should set the remote permissions of directories and files, but only after their content has been downloaded, so that local files and directories can be created for download, even when the remote directory does not have write permission enabled.
Thus it could even download and reproduce a directory tree without write permissions.