SFTP's "get" needs write permission

1

2

I'm connecting to a server using sftp through console. I'm trying to download a folder which has some files without write permission for anyone. When I use get, those files throw an error that says I need write permissions, but the rest download fine.

It seems to be a problem with the console program, I tried WinSCP and it works fine, but I'd like to know if it's possible to do it from a terminal without changing permissions.

The local system runs Windows 7 with Cygwin, the remote one Ubuntu 12.04.

Example:

Couldn't open local file "website/sites/default/default.settings.php" for writing: Permission denied
Download of file /var/www/website/sites/default/default.settings.php to website/sites/default/default.settings.php failed

EDIT:

Permissions on remote server:

website/             755
sites/               775
default/             555
default.setting.php  664

The local directory in which I start sftp has 755 permissions. After the get, files and directories seem to retain the same permissions they had on the remote server, so since default has no write permissions, nothing can be downloaded into it.

How can I get files without retaining the original permissions?

QOI

Posted 2015-02-19T08:23:10.087

Reputation: 111

3The error is likely to refer to the place where you're getting the files to. Check that you have write permission in the directory where you're starting the sftp client. – Flup – 2015-02-19T08:34:31.840

Please include a dump (or screenshot) of the console. What platform are you on? I assume it's OpenSSH sftp, right? – Martin Prikryl – 2015-02-19T08:53:08.290

1Could you edit your question to include the permissions on the local directory website/sites/default and the file website/sites/default/default.settings.php? – Kenster – 2015-02-19T16:05:34.300

How exactly are you running sftp? What command-line options are you using? – Kenster – 2015-02-23T10:36:33.303

@Kenster just sftp -P <port> <user>@<host>, then get -r /var/www/website – QOI – 2015-02-24T11:37:24.250

Answers

0

Running the console program as administrator solved this problem, for me, on Windows 10. I use git bash. As @Flup said, you must have write permission in the directory where you start the sftp client.

Pickles G Jones

Posted 2015-02-19T08:23:10.087

Reputation: 11