Dear community,
I have to copy a file from Red Hat to another server that supports only SSH2.
SFTP command from Red Hat works fine, but since I have to insert SFTP command into a script, is it possibile to PUT file using SFTP in "one" line code?
Or, anyway, without using external file?
This works, but instead to put, it GET the file FROM the server:
# scp local-file user@10.99.1.12:/path/to/remote/file
scp1 compatibility mode is not supported.
This because, as far I know, SCP supports only SSH v1 and destination server accept only connection with SSH v2.
Instead with SFTP, I got:
sftp user@10.99.1.12
sftp> put test.sh
Uploading test.sh to /SYS$SYSDEVICE/USER/test.sh
test.sh 100% 108 0.1KB/s 00:00
So, it's currently working, the only things is that SFTP works in interactive mode, so that's why I'm asking if there is a way to put the command in one line without using external file.
# scp -2 server1.log user@10.99.1.12:server1.log
This is SERV11, Unauthorized Access Prohibited.
scp1 compatibility mode is not supported.
The server machine is OpenVMS OS. Last days I had found a solution with pscp (putty scp). But, if one of the server is unreachable (e.g. for maintenance), the PSCP hangs. That's no good since the script runs from crontab every 5 minutes!
With OpenSSH I can setup the TimeoutConnection to a few seconds, so if the server is down, the script continues with the copy to the other servers after a few seconds.
I cannot find any way to downgrade the timeout on PSCP as already do on OpenSSH.
Thank you binlib, this is a nice workaround, but, at this point, I prefer to use an external sftp command file rather than a WA. This for script stability!