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

Author Message
Mentat

Guest


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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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.
_________________
Martin Prikryl
Mentat

Guest


prikryl wrote:
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.


Hi,
attached are the two logs
Thanks
log - manual.txt (10.21 KB) [Download]

Description: This is the log when i start winscp manually and copy-paste each line from the script to the command line

log - with script.txt (8.27 KB) [Download]

Description: this is the log when i run the script

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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/.
_________________
Martin Prikryl
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
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".
Code:
> 2014-12-14 08:50:59.294 Script: put c:\test\*.* /remotepath/


Please double-check the file C:\Program Files (x86)\WinSCP\script.txt.
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
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?
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License