SFTP client script broken after OpenSSH 2.5.1p1 to 2.5.2p2-1
Davis, Ricardo C.
RCDavis at intermedia.com
Sat Apr 7 04:29:00 EST 2001
Ben,
I was able to get the "put <filename> <dirname>" sftp command to work. I'm
somewhat concerned that the server I'm sending this to is a Win2k box and
this command may not work properly in that environment. We shall see...
The -b option is great -- anything to help catch errors is good. Maybe I'll
stay with 2.5.2p2 after all and hope my other problem shakes out in 2.5.3p1.
:)
Thanks again for your help!
-Ricardo
-----Original Message-----
From: mouring at etoh.eviladmin.org [mailto:mouring at etoh.eviladmin.org]
Sent: Friday, April 06, 2001 12:39 PM
To: Davis, Ricardo C.
Cc: openssh-unix-dev at mindrot.org
Subject: RE: SFTP client script broken after OpenSSH 2.5.1p1 to
2.5.2p2-1
$ sftp localhost <<EOF
> cd /tmp
> put canohost.c
> ls
> EOF
Connecting to localhost...
mouring at localhost's password:
sftp> sftp> Uploading canohost.c to /tmp/canohost.c
sftp> drwxrwxrwt 2 root wheel 512 Apr 6 11:33 .
drwxr-xr-x 15 root wheel 512 Mar 16 21:35 ..
-rw------- 1 mouring wheel 0 Apr 4 11:22 ccbe9396.c
-rw------- 1 mouring wheel 0 Apr 4 11:22 ccfp9396.o
-rw------- 1 mouring wheel 0 Apr 4 11:25 ccOY9396.ld
-rw------- 1 mouring wheel 26 Apr 6 11:32 shWob21730
-rw-r--r-- 1 mouring wheel 8686 Apr 6 11:33 canohost.c
sftp>
$
Works perfectly fine. <shrug> Without more information not sure what
to tell you.
sftp localhost <<EOF
put canohost.c /tmp
ls /tmp
EOF
also works under the current CVS.. I believe 2.5.2pX should work the
same way. That way you are avoding the whole 'cd' thing.
You may want to think about using:
sftp hostname -b transferscript.ftp
The nice feature about batchmode is it will quit on errors. So when
any command fails it will stop and not attempt to run the rest of the
script. Where as:
sftp localhost <<EOF
...
EOF
will not.
- Ben
On Fri, 6 Apr 2001, Davis, Ricardo C. wrote:
> But did you try to "put" a file into /tmp? Did it work?
>
> I will give it a try with the blank line in the here document.
>
>
> -Ricardo
>
> -----Original Message-----
> From: mouring at etoh.eviladmin.org [mailto:mouring at etoh.eviladmin.org]
> Sent: Friday, April 06, 2001 12:23 PM
> To: Davis, Ricardo C.
> Cc: openssh-unix-dev at mindrot.org
> Subject: Re: SFTP client script broken after OpenSSH 2.5.1p1 to
> 2.5.2p2-1
>
>
>
> Hmm.. I can't mimic this under the current CVS version.
>
> sftp localhost <<EOF
> cd /tmp
> ls
> EOF
>
> works fine over here.. When I was testing 2.5.2 w/ the new -b batchfile
> mode I was very careful not to break that feature.
>
> Can you try something for me and put a blank line before the 'cd $PDIR'?
>
> - Ben
>
>
> On Fri, 6 Apr 2001, Davis, Ricardo C. wrote:
>
> > Hello friends,
> >
> > I have a script that uses the sftp client to transfer a file to another
> > server using PK authentication. It was working until I upgraded from
> > OpenSSH 2.5.1p1 to 2.5.2p2-1 yesterday (on a RH Linux 6.2 system). The
> sftp
> > command is:
> >
> > sftp -o "IdentityFile ~/.ssh/id_dsa" \
> > $PUSERNAME@$PSERVER >$TEMPFILE 2>&1 <<-!
> > cd $PDIR
> > put $DOC_ARCHIVE
> > ls
> > quit
> > !
> >
> > Now when I run the script in test mode where it logs into an account on
> the
> > same box the script appears to ignore the current directory set by the
> "cd"
> > command and will "put" the file in the home directory of PUSERNAME. I
> > checked to make sure $PDIR was set and it is ... because when I do the
> "ls"
> > in sftp it lists the other files already present in the target
> subdirectory.
> > When I do a "set -x" before this command, here's what happens:
> >
> > sftp> sftp> Uploading fci0406a.zip to fci0406a.zip
> > sftp> drwxrwxr-x 2 pusernam pusernam 4096 Mar 26 15:58 .
> > drwxr-x--- 5 pusernam acctAdm 4096 Apr 6 11:30 ..
> > -rw-r--r-- 1 pusernam pusernam 76280 Mar 23 17:20 fci0323a.zip
> > -rw-r--r-- 1 pusernam pusernam 38151 Mar 23 17:20 fcd0323a.zip
> > -rw-r--r-- 1 pusernam pusernam 38151 Mar 23 17:20 fcp0323a.zip
> > -rw-r--r-- 1 pusernam pusernam 76280 Mar 26 17:39 fci0326a.zip
> > -rw-r--r-- 1 pusernam pusernam 38151 Mar 26 17:39 fcd0326a.zip
> > -rw-r--r-- 1 pusernam pusernam 38151 Mar 26 17:39 fcp0326a.zip
> >
> > When I check out the home directory of this account I find the file was
> > transferred there.
> >
> > Has this problem been identified (I didn't see it on the errata page)
and
> > fixed? How long before the next release with the fix?
> >
> >
> > -Ricardo
> > ...going back to 2.5.1p1 :(
> >
> > --------------------------------------------------------------------
> > Intermedia Communications
> > Ricardo Davis ABN-Information Systems
> > rcdavis at intermedia.com http://www.intermedia.com/products/abn/
> > --------------------------------------------------------------------
> >
>
>
More information about the openssh-unix-dev
mailing list