[HPADM] SFTP Scripting

From: Roger Realsen (roger.realsen@wareforce.com)
Date: Wed Nov 29 2006 - 18:08:28 EST


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@wareforce.com

IM: TrendGod98 Yahoo: trendgod MSN: trendgod@cox.net

"We make IT run better."

 


--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:54 EDT