sftp client stores files and directories with wrong permissions received by the server and lets download fail
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openssh (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Ubuntu: 14.04 LTS
The problem occurs always, but only with remote site reporting wrong/broken file permissions:
sftp downloads files with those wrong permissions. The download succeeds for a single file or directory, but to access the local file/directory, you have to chmod it locally.
Recursive downloads fail reproducibly, because the local directory created by sftp during the download lacks permission to add the remote files to be downloaded into it.
If the local directory already exists with the right permissions, the permissions are unchanged by sftp and the remote files and directories can be created and downloaded into it, but both with the wrong permissions.
A network resource wasting workaround for a manual download of a directory could be to chmod +rwX the local directories after a failed download and try the download command again, then chmod the local download tree again, try the download again, ... , until the download was finally 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/
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:
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.
description: | updated |
tags: | added: trusty |
tags: | added: sftp |
description: | updated |
description: | updated |
Status changed to 'Confirmed' because the bug affects multiple users.