[HPADM] [SUMMARY] RE: SFTP Scripting



Solved my problem by using "scp"



Thanks to all who supplied input.



1. Exchanged keys with partner

2. PUT FILE: "scp <local_dir><local_file>
<user>@<server>:<remote_dir><remote_file>"

3. GET FILE: "scp <user>@<server>:<remote_dir><remote_file>
<local_dir><local_file>"



Sincerely

Roger Realsen



From: hpux-admin-owner@xxxxxxxxxxxxx
[mailto:hpux-admin-owner@xxxxxxxxxxxxx] On Behalf Of Roger Realsen
Sent: Wednesday, November 29, 2006 3:08 PM
To: hpux-admin@xxxxxxxxxxxxx
Subject: SFTP Scripting



Gurus



HP 9000 rp3440-4

HPUX 11.11



BACKGROUND

We are trying to set up an SFTP environment with a partner. In this
communication we will be logging in to their SFTP server and getting and
putting different files. This routine needs to happen through run-time
Progress program in the middle of the night (basically like a CRON job).
We have installed SFTP on our UNIX box and have exchanged a public key
(id_rsa) with the partner.



I can successfully log in and do everything I need manually ... all I
need to now is to script it so it is non-interactive.



Manually I can do the following:

# sftp <user>@<server>

# <password>

# cd <directory>

# lcd <local_directory>

# get <filename>

# quit



Everything works out fine here. Now, after digging around the internet
and through the archives, I saw a couple of links and read as much as I
can understand. The script I am attempting to use is as follows:



Begin Script:

============================

# !/bin/sh

echo "Beginning test of scripted sftp ... "

sftp -b /dev/null <user>@<server> << EOF

cd <directory>

lcd <local_directory>

get <filename>

quit

EOF

Echo "Ending of test sftp script ... "

============================

End Script



When running the script using ...

# sh -x <script_file>



I get the following output ...

+ echo Beginning test of scripted sftp ...

Beginning test of scripted sftp ...

+ sftp -b /dev/null <user>@<server>

+ 0< /var/adm/sh534.1

+echo Ending of test sftp script ...

Ending of test sftp script ...



I am at a complete loss on what to do now. Can anyone lend a hand?



Sincerely

Roger Realsen



Roger Realsen | Director of IT | Wareforce | office: 949.452.1411 | fax:
949.452.1413 | roger.realsen@xxxxxxxxxxxxx

IM: TrendGod98 Yahoo: trendgod MSN: trendgod@xxxxxxx

"We make IT run better."





Relevant Pages

  • Re: sftp exit codes?
    ... I am using scp along with BatchMode on command line. ... better choice over sftp. ... of exit codes for the sftp program and what each one ... I'm actually porting a shell script that use to use ...
    (SSH)
  • Re: sftp script for application promotion
    ... execute the transfers. ... You don't have such things as sftp scrips. ... You can create a shell script ... You can create batch files with sftp though, ...
    (comp.sys.sun.admin)
  • Re: which is better libssh or libssh2
    ... And how is sftp more secure than scp or rsync over ssh? ... As I said AFAIK libssh2 impliments the ssh2 protocol which is more secure ... transmission timing will swamp any script issues. ...
    (comp.security.ssh)
  • [HPADM] SFTP Scripting
    ... We are trying to set up an SFTP environment with a partner. ... need to now is to script it so it is non-interactive. ... Echo "Ending of test sftp script ... ...
    (HP-UX-Admin)