WinSCP put not working in script, but is working in CLI

Advertisement

Mentat
Guest

WinSCP put not working in script, but is working in CLI

Hi,
this is my first time trying scripting with WinSCP so pardon me if the question seems stupid.

i'm running the following script

option batch abort
option confirm off
open sftp://sftp:sftp@192.168.0.63/ -hostkey="ssh-rsa 1024 36:02:11:38:17:52:28:02:1e:eb:55:35:db:ed:ba:77"
put c:\test\*.*
exit

and i get a premission denied, error code 3 each time.

however, if i do this manually i works every time

by manually i mean i run winscp.com
then paste: open sftp://sftp:sftp@192.168.0.63/ -hostkey="ssh-rsa 1024 36:02:11:38:17:52:28:02:1e:eb:55:35:db:ed:ba:77"

then paste put c:\test\*.*

i don't think there's a premission issue since i works manually, i searched for quite a while and i'm stumped.

Please help

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: WinSCP put not working in script, but is working in CLI

Please attach a full log file for both scenarios (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Mentat
Guest

Re: WinSCP put not working in script, but is working in CLI

Hi,
attached are the two logs
Thanks
Description: This is the log when i start winscp manually and copy-paste each line from the script to the command line
Description: this is the log when i run the script

Reply with quote

martin
Site Admin
martin avatar

Re: WinSCP put not working in script, but is working in CLI

The only difference is that in manual log you upload to /, while in script log, you upload to /remotepath/. Well I assume that /remotepath is not a real path, but still it suggests that it's not /. That makes the logs incomparable. Please attach logs for really identical scenarios. Otherwise I must assume that you have a write access to /, but do not to /remotepath/.

Reply with quote

Mentat
Guest

Hi Martin and thanks,
The problem is that i am using the exact same command in both cases:
"put c:\test\*.*"
i tested it right now and when i manually type "/remotepath" in winscp console i do get the same error message.
what i'm guessing is that for some reason within the script the put command is interpreted to contain a "/remotepath" as a destination parameter while in manual console it does not....
any ideas?
Thanks
Oriel

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Mentat wrote:

The problem is that i am using the exact same command in both cases:
"put c:\test\*.*"
That does not seem to be true, WinSCP logs the command as it is in the script file. It does not do any "interpretation".
> 2014-12-14 08:50:59.294 Script: put c:\test\*.* /remotepath/

Please double-check the file C:\Program Files (x86)\WinSCP\script.txt.

Reply with quote

Mentat
Guest

this is an exact copy-paste from script.txt:

option batch abort
option confirm off
open sftp://sftp:sftp@192.168.0.63/ -hostkey="ssh-rsa 1024 36:02:11:38:17:52:28:02:1e:eb:55:35:db:ed:ba:77"
put c:\test\*.*
exit

any ideas?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

My only idea is that you are a victim of file system redirection (as this is about directory that normal account does not have a write access to).

If you run WinSCP (under the same local account as you run the script) and open the C:\Program Files (x86)\WinSCP\script.txt in its internal editor, does the file look the same?

Reply with quote

Advertisement

You can post new topics in this forum