[prev in list] [next in list] [prev in thread] [next in thread]
List: aix-l
Subject: Re: Non-Interactive SFTP
From: "Naylor, Jim" <Jnaylor () SCHNUCKS ! COM>
Date: 2003-04-28 20:38:44
[Download RAW message or body]
Thanks to Shekhar Dhotre. I installed EXPECT and it did the trick. Thanks
to all that replied.
-----Original Message-----
From: Shekhar Dhotre [mailto:Shekhar.Dhotre@LENDLEASEREI.COM]
Sent: Friday, April 25, 2003 9:46 PM
To: aix-l@princeton.edu
Subject: Re: Non-Interactive SFTP
Yes , I have automated sftp using expect ..see below
Poking around /usr/local/bin with the command ll | more, I found autoexpect.
It's not in the book, What`s Autoexpect ?
autoexpect - generate an EXPECT script from watching a session.
This is a cool program. I can run a TELNET or FTP session to a Linux from
AIX or between any systems and create an EXPECT script from the session
that I can run any time I wish.
( Ftp`d one file from hrdev to linux server and created test1.exp script
using autoexpect )
f3n43#autoexpect -f test1.exp sftp egbert
autoexpect started, file is test1.exp
Connecting to egbert...
root@egbert's password:
sftp> put README
Uploading README to /root/README
sftp> quit
autoexpect done, file is test1.exp
The file test1.exp is the script created by autoexpect.Examining test1.exp
shows the details of the two-way conversation between the Linux machine and
the AIX. Every character is saved in either a send or expect command. Even
the password is saved, so care must be taken with these scripts.
I can rerun this script(test1.exp) any time I wish simply by typing
test1.exp at the prompt. It puts README file by reading commands in the
script .
f3n43 /usr/sshdownload/expect/expect-5.38>test1.exp
spawn sftp egbert
Connecting to egbert...
root@egbert's password:
sftp> put README
Uploading README to /root/README
sftp> quit
f3n43 /usr/sshdownload/expect/expect-5.38>
"Naylor, Jim" <Jnaylor@SCHNUCKS.COM>
Sent by: IBM AIX Discussion List <aix-l@Princeton.EDU>
04/25/2003 03:25 PM
Please respond to
IBM AIX Discussion List <aix-l@Princeton.EDU>
To
aix-l@Princeton.EDU
cc
Subject
Re: Non-Interactive SFTP
I tried this command according to the man pages:
scp -B username@servername:test.file
and it kept comming back with the usage. What am I doing wrong?
-----Original Message-----
From: Aaron Morris [mailto:aaronmorris@MINDSPRING.COM]
Sent: Friday, April 25, 2003 12:41 PM
To: aix-l@princeton.edu
Subject: Re: Non-Interactive SFTP
Why not just use scp?
Naylor, Jim wrote:
> Hello All,
> According to the man pages on SFTP you can use the -b to automate SFTP.
The
> -b points to a command file that has the sftp commands. Has anyone been
> able to get SFTP to work in a script form like ftp. We do the following
for
> ftp automation:
>
> echo "user username password" > ftpfile
> echo "cd abcd" >> ftpfile
> echo "get filename" >> ftpfile
> echo "bye" >> ftpfile
>
> ftp ftpsite < ftpfile
>
> I have tried to do something similar with SFTP but cannot seem to get it
to
> work. This script needs to be run by a user other than the sftp login
user.
> According to the man pages I would have to do sftp username@sftpserver.
Any
> ideas would be appreciated.
>
> Thanks,
> Jim Naylor
> Unix Systems Administrator
> Schnuck Markets, Inc.
> * Direct: (314) 994-4784
> *)) Cell: (314) 691-0186
> * Fax : (314) 994-4684
> * jnaylor@schnucks.com
>
--
Aaron W Morris
decep
PGP Key ID: 259978D1
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=707053320-28042003><FONT face=Arial color=#0000ff size=2>Thanks
to Shekhar Dhotre. I installed EXPECT and it did the trick.
Thanks to all that replied.</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Shekhar Dhotre
[mailto:Shekhar.Dhotre@LENDLEASEREI.COM]<BR><B>Sent:</B> Friday, April 25,
2003 9:46 PM<BR><B>To:</B> aix-l@princeton.edu<BR><B>Subject:</B> Re:
Non-Interactive SFTP<BR><BR></FONT></DIV><BR><FONT face=Arial size=2>Yes , I
have automated sftp using expect ..see below </FONT><BR><BR><BR><FONT
face=Arial size=2>Poking around /usr/local/bin with the command ll | more, I
found autoexpect. It's not in the book, What`s Autoexpect ?</FONT>
<P><FONT face=Arial size=2>autoexpect - generate an EXPECT script from
watching a session.</FONT>
<P><FONT face=Arial size=2>This is a cool program. I can run a TELNET or FTP
session to a Linux from AIX or between any systems and create an EXPECT
script from the session that I can run any time I wish.</FONT> <BR><BR><FONT
face=Arial size=2>( Ftp`d one file from hrdev to linux server and created
test1.exp script using autoexpect )</FONT> <BR><BR><FONT face="Courier New"
size=2>f3n43#autoexpect -f test1.exp sftp egbert </FONT><BR><FONT
face="Courier New" size=2>autoexpect started, file is test1.exp
</FONT><BR><FONT
face="Courier New" size=2>Connecting to egbert...
</FONT><BR><FONT face="Courier New" size=2>root@egbert's
password:
</FONT><BR><FONT
face="Courier New" size=2>sftp> put README
</FONT> <BR><FONT face="Courier New"
size=2>Uploading README to /root/README
</FONT> <BR><FONT
face="Courier New" size=2>sftp> quit
</FONT> <BR><FONT
face="Courier New" size=2>autoexpect done, file is test1.exp
</FONT><FONT face=sans-serif size=2><BR></FONT><BR><FONT face=Verdana
size=2>The file test1.exp is the script created by autoexpect.Examining
test1.exp shows the details of the two-way conversation between the Linux
machine and the AIX. Every character is saved in either a <B>send</B> or
<B>expect</B> command. Even the password is saved, so care must be taken with
these scripts.</FONT> <BR><BR><FONT face=Verdana size=2> I can rerun this
script(test1.exp) any time I wish simply by typing </FONT><FONT
face="Arial Unicode MS" size=2>test1.exp</FONT><FONT face=Verdana size=2> at
the prompt. It puts README file by reading commands in the script
.</FONT> <BR><BR><FONT face="Courier New" size=2>f3n43
/usr/sshdownload/expect/expect-5.38>test1.exp
</FONT> <BR><FONT face="Courier New" size=2>spawn sftp egbert
</FONT>
<BR><FONT face="Courier New" size=2>Connecting to egbert...
</FONT> <BR><FONT face="Courier New"
size=2>root@egbert's password:
</FONT> <BR><FONT face="Courier New" size=2>sftp> put README
</FONT><BR><FONT face="Courier New" size=2>Uploading README to /root/README
</FONT><BR><FONT face="Courier New" size=2>sftp> quit
</FONT><BR><FONT face="Courier New" size=2>f3n43
/usr/sshdownload/expect/expect-5.38></FONT><FONT face=sans-serif
size=2><BR><BR></FONT><BR><BR><BR>
<TABLE width="100%">
<TBODY>
<TR vAlign=top>
<TD width="40%"><FONT face=sans-serif size=1><B>"Naylor, Jim"
<Jnaylor@SCHNUCKS.COM></B> </FONT><BR><FONT face=sans-serif
size=1>Sent by: IBM AIX Discussion List
<aix-l@Princeton.EDU></FONT>
<P><FONT face=sans-serif size=1>04/25/2003 03:25 PM</FONT>
<TABLE border=1>
<TBODY>
<TR vAlign=top>
<TD bgColor=white>
<DIV align=center><FONT face=sans-serif size=1>Please respond
to<BR>IBM AIX Discussion List
<aix-l@Princeton.EDU></FONT></DIV></TR></TBODY></TABLE><BR></P>
<TD width="59%">
<TABLE width="100%">
<TBODY>
<TR>
<TD>
<DIV align=right><FONT face=sans-serif size=1>To</FONT></DIV>
<TD vAlign=top><FONT face=sans-serif
size=1>aix-l@Princeton.EDU</FONT>
<TR>
<TD>
<DIV align=right><FONT face=sans-serif size=1>cc</FONT></DIV>
<TD vAlign=top>
<TR>
<TD>
<DIV align=right><FONT face=sans-serif size=1>Subject</FONT></DIV>
<TD vAlign=top><FONT face=sans-serif size=1>Re: Non-Interactive
SFTP</FONT></TR></TBODY></TABLE><BR>
<TABLE>
<TBODY>
<TR vAlign=top>
<TD>
<TD></TR></TBODY></TABLE><BR></TR></TBODY></TABLE><BR><BR><BR><FONT
size=2><TT>I tried this command according to the man pages:<BR><BR>scp -B
username@servername:test.file<BR><BR>and it kept comming back with the usage.
What am I doing wrong?<BR><BR>-----Original Message-----<BR>From: Aaron
Morris [mailto:aaronmorris@MINDSPRING.COM]<BR>Sent: Friday, April 25, 2003
12:41 PM<BR>To: aix-l@princeton.edu<BR>Subject: Re: Non-Interactive
SFTP<BR><BR><BR>Why not just use scp?<BR><BR>Naylor, Jim wrote:<BR>> Hello
All,<BR>> According to the man pages on SFTP you can use the -b to automate
SFTP.<BR>The<BR>> -b points to a command file that has the sftp commands.
Has anyone been<BR>> able to get SFTP to work in a script form like
ftp. We do the following<BR>for<BR>> ftp automation:<BR>><BR>>
echo "user username password" > ftpfile<BR>> echo "cd abcd" >>
ftpfile<BR>> echo "get filename" >> ftpfile<BR>> echo "bye"
>> ftpfile<BR>><BR>> ftp ftpsite < ftpfile<BR>><BR>> I
have tried to do something similar with SFTP but cannot seem to get
it<BR>to<BR>> work. This script needs to be run by a user other than
the sftp login<BR>user.<BR>> According to the man pages I would have to do
sftp username@sftpserver.<BR>Any<BR>> ideas would be
appreciated.<BR>><BR>> Thanks,<BR>> Jim Naylor<BR>> Unix Systems
Administrator<BR>> Schnuck Markets, Inc.<BR>> * Direct: (314)
994-4784<BR>> *)) Cell: (314) 691-0186<BR>> * Fax : (314)
994-4684<BR>> * jnaylor@schnucks.com<BR>><BR><BR>--<BR>Aaron W
Morris<BR>decep<BR>PGP Key ID:
259978D1<BR></TT></FONT><BR></P></BLOCKQUOTE></BODY></HTML>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic