Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Unable to script file transfer because CWD is not allowed on remote server

Sorry, there's no chance to make WinSCP working against a zOS server with disallowed CWD command. Either of them alone is a huge complication. And combined... it's a nightmare.
Guest

Re: Unable to script file transfer because CWD is not allowed on remote server

Unfortunately, the remote server does not support SFTP.
I have since learned that the remote system is zOS, so the issue may be that WinSCP injects a forward slash in the path. I tried adding the -rawsettings FtpWorkFromCwd=on parameter to the open command, but then WinSCP tries to issue a CDUP command. I know there are some compatibility issues with non *nix systems and FTPS with at least some versions of WinSCP. We are currently using version 5.19.
Given this information, is there a way to make this work through the command line with this or another version?
martin

Re: Unable to script file transfer because CWD is not allowed on remote server

Sorry, there's no option to change this behavior. Can you use SFTP instead?
Guest

Unable to script file transfer because CWD is not allowed on remote server

I am attempting to script a file transfer which fails due to security restrictions on the remote server. It appears that WinSCP is sending unnecessary commands during this process. Transferring through the GUI works fine.

In the log excerpt below, it seems that the highlighted commands are not necessary. Is there any way to prevent these commands or am I missing something fundamental?
***

Command-line: "C:\WinSCP\WinSCP.exe" /loglevel=0 /log=C:\Temp\WinSCP.log /command "open ftps://FTPUSER:***@257.257.257.257:21/ -explicit -rawsettings MinTlsVersion=12 PostLoginCommands=PBSZ%200%0ASITE%20REC=FB%20LRECL=94%0AEPSV%0APROT%20P" "cd home" "put ""C:\Temp\File.txt"" -transfer=ascii" "exit"
***
Script: TLS connection established. Waiting for welcome message...
TLS connection established. Waiting for welcome message...
USER FTPUSER
331 Send password please.
PASS ********
FTPUSER is logged on. Working directory is "FTPUSER.".
SYST
500 User Exit denies Userid 'FTPUSER' from using Command 'SYST'.
FEAT
User Exit denies Userid 'FTPUSER' from using Command 'FEAT'.
PBSZ 0
Protection buffer size accepted
PROT P
200 Data connection protection set to private
Script: Connected
Connected
--------------------------------------------------------------------------
Using FTP protocol.
Doing startup conversation with host.
Script: Starting the session...
PBSZ 0
200 Protection buffer size accepted
SITE REC=FB LRECL=94
200 SITE command was accepted
EPSV
229 Entering Extended Passive Mode (|||28624|)
PROT P
200 Data connection protection set to private
PWD
257 "'FTPUSER.'" is working directory.
Getting current directory name.
Startup conversation with host finished.
Script: Session started.
Script: Active session: [1] FTPUSER@257.257.257.257
Script: cd home
Cached directory change via "home" to "/'USR.XXXXX.'".
Getting current directory name.
Script: /'USR.XXXXX.'
Script: put "C:\Temp\File.txt" -transfer=ascii
Copying 1 files/directories to remote directory "/'USR.XXXXX.'" - total size: 960
PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
TM: A; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
File: 'C:\Temp\File.txt' [2022-10-18T15:48:01.116Z] [960]
Copying "C:\Temp\File.txt" to remote directory started.
Ascii transfer mode selected.
Starting upload of C:\Temp\File.txt
CWD /'USR.XXXXX.'
500 User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
CWD /
500 User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
Copying files to remote side failed.
(ExtException) **Copying files to remote side failed.**
User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
Asking user:
Error transferring file 'C:\Temp\File.txt'. ("Copying files to remote side failed.","User Exit denies Userid 'FTPUSER' from using Command 'CWD'.")
Script: Error transferring file 'C:\Temp\File.txt'.
Script: Copying files to remote side failed.
User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
Answer: Abort
(ESkipFile) Error transferring file 'C:\Temp\File.txt'.
Copying files to remote side failed.
User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
Copying finished: Transferred: 0, Elapsed: 0:00:00, CPS: 0/s
Script: Failed
Script: Exit code: 1
Disconnected from server