4

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?

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

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .