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?

  • 3
    The 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 Feb 19 '15 at 8:34
  • Please include a dump (or screenshot) of the console. What platform are you on? I assume it's OpenSSH sftp, right? – Martin Prikryl Feb 19 '15 at 8:53
  • 1
    Could 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 Feb 19 '15 at 16:05
  • How exactly are you running sftp? What command-line options are you using? – Kenster Feb 23 '15 at 10:36
  • @Kenster just sftp -P <port> <user>@<host>, then get -r /var/www/website – QOI Feb 24 '15 at 11:37
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.