HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert an ftp command to sftp

 
Thomas Jones2
Occasional Advisor

how to convert an ftp command to sftp

code snippet example:

ftp -i -v pla_img_prod >/app/pro1/if/image_retrieval/image_retrieval_work_out/if280ftp20031021090405.0001.log 2>&1 << !
binary
get "lolc4\LC3034\ky575184001ad65b.pdf" /app/pro1/if/image_retrieval/image_retrieval_work_in/ky575184001ad65b.pdf
9 REPLIES
Steven Schweda
Honored Contributor

Re: how to convert an ftp command to sftp

So, "man sftp" didn't work?

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

Is there some particular mystery here, or are
you completely bewildered?

Sometimes you get more help if you appear to
be trying to solve the problem yourself,
rather than asking others to do your whole
job for you.

Just a thought.
Steven E. Protter
Exalted Contributor

Re: how to convert an ftp command to sftp

Shalom,

You could just use scp, which will work without any scripting.

See this doc:
http://www.hpux.ws/?p=10

safe, secure password free openssh, which includes sftp,ssh and scp.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Thomas Jones2
Occasional Advisor

Re: how to convert an ftp command to sftp

SEP,

I would prefer to use scp, but we are under mandate to uses sftp.

Unfortunately, according to the man page sftp "is an interactive file transfer program" which is not what we need for batch processing. The [-o ssh_option] looks promising, if it can put sftp into a batch mode.

We handle error checking by grep on the log file looking for keywords.

After looking for a list of sftp errors, all I can find is this:

http://fixunix.com/ssh/330198-sftp-errors-messages.html

I don't even know if this is correct for the version of sftp we will use.

We don't even have an agreement regarding keys so we can eliminate storing passwords, yet they want this implimented by month end.

Thanks,
Tom
Modris Bremze
Esteemed Contributor

Re: how to convert an ftp command to sftp

sftp should have a -b option which allows to specify a [batch] file with commands for sftp to execute. You will also probably have to set up 'password-less' authentication for scripting.
Steven Schweda
Honored Contributor

Re: how to convert an ftp command to sftp

> Unfortunately, according to the man page
> sftp "is an interactive file transfer
> program" which is not what we need for
> batch processing.

How is that different from your FTP client?

> The [-o ssh_option] looks promising, if it
> can put sftp into a batch mode.

It may be useful, but perhaps not much better
than getting commands from redirected input
(like the here-document in your FTP script
fragment).
Tingli
Esteemed Contributor

Re: how to convert an ftp command to sftp

-b can be for batch mode. And it is also possible to have user name and password in the batch file although it is not highly recommended.
Thomas Jones2
Occasional Advisor

Re: how to convert an ftp command to sftp

If we can get keys installed, the -b option looks good since they want us to quit using netrc files. Plus I don't think sftp works with netrc.
James R. Ferguson
Acclaimed Contributor

Re: how to convert an ftp command to sftp

Hi Thomas:

See my comments including a shell-based SFTP batch script in this thread:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1265334

Regards!

...JRF...
Thomas Jones2
Occasional Advisor

Re: how to convert an ftp command to sftp

still working on this