1835947 Members
3515 Online
110088 Solutions
New Discussion

script embedding sftp

 
lastgreatone
Regular Advisor

script embedding sftp

I want to create an automated script on an hp260/11 server to dump files on a RD linux 7.0. I have an ftp script which does this:
ftp -i -n <<-EOF
open www.xxx.xx
user user_name password
bin
put file_log
quit
EOF
Anyone know what the equivalent (switches) would be for sftp2 (using F-Secure ssh 2.1 on hpux) and on Linux it is Openssh 2.1)?
7 REPLIES 7
Darrell Allen
Honored Contributor

Re: script embedding sftp

Hi Frankie,

Why not use scp instead of sftp? I find that to be a much cleaner approach.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
lastgreatone
Regular Advisor

Re: script embedding sftp

I scp'd the public key to the remote server into the authorization file. I enabled public key authorization in the sshd2_config file. When I scp from the client I still get prompted for a password. Yet I ssh-keygen with a passphrase, any clues?
harry d brown jr
Honored Contributor

Re: script embedding sftp

Frankie,

use perl:

http://search.cpan.org/search?mode=module&query=sftp

live free or die
harry
Live Free or Die
Darrell Allen
Honored Contributor

Re: script embedding sftp

I not sure if you have to do this but after enabling public key authorization, did you restart sshd? Did you get prompted for a password or for a passphrase?

With F-Secure sshd, you can use keys without a passphrase. It would be more secure to have the passphrase though I'm not sure how you would use ssh-agent and ssh-add in an automated, scripted environment. This thread may help:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x2ebca2db8513d6118ff40090279cd0f9,00.html

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
lastgreatone
Regular Advisor

Re: script embedding sftp

Thanks for the links, I see I'm not the only one frustrated with ssh. Why do I keep getting Failed to connect to authentication agent - agent not running ? and yet it's running!! what I'm I doing wrong?
Darrell Allen
Honored Contributor

Re: script embedding sftp

After running ssh-agent, did you set and export SSH_AUTH_SOCK and SSH_AGENT_PID to what ssh-agent displayed?

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
lastgreatone
Regular Advisor

Re: script embedding sftp

Yes. At the start of my rlogin session I run ssh-agent2 but when I run ssh-add2 I still get the error. It would appear that the agent inheritence does not occur. I'm not sure why.