6

I am uploading a file from a collection of different servers to one data server. I am using psftp and one out of 20+ servers is producing a permissions problem.

Remote working directory is /
psftp> cd Remote_Directory\ 
Remote directory is now /Remote_Directory/
psftp> put C:\folders\containing\file\FILE.zip    
/Remote_Directory/: open for write: failure
psftp> quit

It appears like a permissions issue on the remote directory, however, why am I only getting the issue on one server? The batch is identical on all of the 20+ servers.

1
  • It's not clear what this has to do with programming. Are you developing/modifying this psftp tool or just using it? Commented Dec 3, 2014 at 16:18

3 Answers 3

7

PUT command expects a file name at the end of the destination location.

Please try the following code

put C:\folders\containing\file\FILE.zip /Remote_Directory/FILE.zip 
Sign up to request clarification or add additional context in comments.

Comments

0

The path in the error message is an exact path to the remote file the psftp tried to create. See outfname in below code snippet:

req = fxp_open_send(outfname,
                        SSH_FXF_WRITE | SSH_FXF_CREAT | SSH_FXF_TRUNC,
                        &attrs);
...
printf("%s: open for write: %s\n", outfname, fxp_error());

As the path is obviously not correct (lacks file name), it seems that psftp got confused somehow. I believe it's likely due to wrong (back)slash you have used in the cd command.

Try cd Remote_Directory/.

1 Comment

I had tried cd Remote_Directory/ as well as cd Remote_Directory and i get the same results. Remote working directory is / psftp> cd Remote_Directory/ Remote directory is now /Remote_Directory/ psftp> put C:\folders\containing\file\FILE.zip /Remote_Directory/: open for write: failure psftp> quit
0

In my case, it's a permission issue on the remote server, i.e. the account you are using to log on doesn't have the write permission for the remote folder.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.