Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Automate SFTP

SOLVED
Go to solution
Vibhor
Occasional Visitor

Automate SFTP

Hi all,

I want to automate SFTP to one of our managed node as FTP ports are not open for the same.

Please provide me a script if someone has done the same.

Cheers:)
5 REPLIES
Karl Rohwedder
Honored Contributor

Re: Automate SFTP

Vibhor,

you must use the -B option to specify a file, which contains the commands to use, e.g.

$ sftp "-B" a.bat ! pls. note the "" to force uppercase

where A.BAT may contain e.g.:
open -l node
ls

If A.BAT is not STMLF, SFTP converts it on the fly (at least under TCPIP V5.6).

regards Kalle
Steve-Thompson
Regular Advisor

Re: Automate SFTP

Hi Vibhor

I havent used SFTP yet but I would imagine it's very similar in it's use to regular FTP.

A simple FTP example :---

script.com ....
--------------
$!
$ sftp name-sftp-server
username
password
dir
put some-file
dir
bye
$!
----------------
According to the book you can use...
$ sftp -B file-with-sftp-commands.com user@node

You put the ftp commands in the "file" indicated by "-B"

I found this in the "TCPIP Services for OpenVMS GUIDE TO SSH"

Richard Whalen
Honored Contributor
Solution

Re: Automate SFTP

To automate, or use SFTP in batch mode, you must set up either public key (preferred) or host based authentication. SSH (which SFTP uses as a transport) does not accept passwords when used in batch mode because of the potential of the command file being read and the password being obtained by people that should not have it.

Public key and host based authentication require placing files containing public keys in the correct places and setting up other control files to point to them. The manuals show this information and it has been discussed here before.
Volker Halle
Honored Contributor

Re: Automate SFTP

Vibhor,

please see my previous thread about setting up SFTP on OpenVMS:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=985928

Hope this helps,

Volker.
Vibhor
Occasional Visitor

Re: Automate SFTP

Thanks guys,
Yes I did see the solutions provided earlier.
This should work.

Cheers:)
vibhor