Ftp Automatic Login Help

  • Follow


I am trying to auto ftp process, but I can't get around the login prompt.

Anyone have any idea?

Very appreciated.

Ste


0
Reply Ste 8/2/2003 2:35:45 AM

In article <5sFWa.252$nt1.179@newssvr16.news.prodigy.com>, Ste wrote:

>I am trying to auto ftp process, but I can't get around the login prompt.

I suggest ssh instead. See comp.security.ssh .  With ftp you have to store
the password one way or another (except that with anonymous ftp there is
no password to speak of).

You can do ftp something like this:

ftp -n 192.168.0.1 << END
user THEUSERNAME THEPASSWORD
get RELEASE-NOTES
bye
END

-- 
<peter30kyari@zwallet.com> AWAIT[S] YOUR  URGENT  RESPONCE
5% will be use for upsetting all the expenses
0
Reply elvis 8/2/2003 9:58:56 AM


In article <5sFWa.252$nt1.179@newssvr16.news.prodigy.com>,
Ste <schen@prodigy.net> wrote:
: I am trying to auto ftp process, but I can't get around the login prompt.
: 
You can use an FTP client that was designed to be automated:

  http://www.columbia.edu/kermit/ftpclient.html
  http://www.columbia.edu/kermit/ftpscripts.html

This happens to be the C-Kermit that is included with HP-UX as /bin/kermit.
However, the latest C-Kermit version, 8.0, which is the one that includes
the scriptable FTP client, is found only on HP-UX 11.22.  If you have an
earlier HP-UX release, you can upgrade C-Kermit version here:

  http://www.columbia.edu/kermit/ckermit.html
  http://www.columbia.edu/kermit/ck80binaries.html#hp

- Frank
0
Reply fdc 8/2/2003 5:49:39 PM

"Ste" <schen@prodigy.net> wrote:

>I am trying to auto ftp process, but I can't get around the login prompt.
>
>Anyone have any idea?
>
>Very appreciated.
>
>Ste
>
Ste,

Have a look at the ftp man page.
There is a switch on the ftp command to turn off login prompt, can't
remember what it is by I have wriitten many scripts to do automatic
ftp.
Your ftp script will then need to issue the ftp command to login.

Regards,
Ted.

==============================================================
| Ted Linnell                 <edlinnell@acslink.net.au>     |
|                                  |
| Nunawading, Victoria , Australia                           |
==============================================================
0
Reply Ted 8/3/2003 8:59:21 AM

> I am trying to auto ftp process, but I can't get around the login prompt.
>
> Anyone have any idea?

Use .netrc file.

Alain.



0
Reply Alain 8/3/2003 8:37:41 PM

Use the Here document methodology, putting a `cat secured_file_with_uid/pwd`
just after your open. Putting your uid/pwd over the net in telnet text is
inevitable, but the above in your script will keep the uid/pwd somewhat
secure on the ftp'ing box. I it really matters, make use of vpn or vpn-like
protocols. Otherwise, you option may be to do some socket programming and
skip the ftp. It ain't that hard, and you might enjoy it.


"Frank Thyes" <frank.thyes.nospam@gmx.net> wrote in message
news:bguc1f$scu97$3@ID-124231.news.uni-berlin.de...
> Alain <ota1998@hotmail.com> wrote:
> >
> >> I am trying to auto ftp process, but I can't get around the login
prompt.
> >>
> >> Anyone have any idea?
> >
> > Use .netrc file.
>
> The only way i know but using .netrc is realy insecure...
>
> Frank
>
> --
> The great thing on multitasking is that several thing can go wrong at one.


0
Reply GT 8/8/2003 2:43:36 AM

Still trying?

What about the thing below
This works for me. I made some error and sanity checks around it as well at
the office but don't have the script handy here at home.

Paul

#!/usr/bin/ksh
#
#
# make a ftp command file. You can use enviroment variables in it as well
#
USER=myaccount
PASSWD=secret
LOCALDIR=/my/local/dir

FILES=$(cd LOCALDIR ; ls *.txt)
NFILES=$(echo $FILES |wc -w)

cat <<EOF >myftp.cmd
user $USER $PASSWD
lcd /my/local/directory
cd $LOCALDIR
prompt off
type ascii
put myfile.txt myfile.txtnew
chmod 644 myfile.txtnew
rename myfile.txtnew myfile.txt
quit
EOF

# The actual ftp

ftp -nv <<myftp.cmd >myftp.log 2>myftp.err

# some checking

result=$(grep -c "^226" myftp.log)
if [ $result -ne $NFILES ]
then
  echo "ftp failed"
  exit -1
fi


0
Reply Paul 8/8/2003 5:31:09 PM

Actually, you could also grep the myftp.log/err for all the result codes.
You get one for each operation - open, login, xfer, etc.  They should be
2xx, not 4xx or 5xx, and are well documented. You might want to ls -l the
files after the xfer, to document that they arrived and are of some size.
Optionally, you might want to run a 'site' or 'quote site' command of some
sort. For instance, given the right ftp pgms, you could compress, send, and
uncompress, if you have a skinny pipe but fast machines. FTP is pretty fun
if you have a good one.

"Paul Sure" <phv_temp@yahoo.com> wrote in message
news:vj7niu8dab7aee@corp.supernews.com...
> Still trying?
>
> What about the thing below
> This works for me. I made some error and sanity checks around it as well
at
> the office but don't have the script handy here at home.
>
> Paul
>
> #!/usr/bin/ksh
> #
> #
> # make a ftp command file. You can use enviroment variables in it as well
> #
> USER=myaccount
> PASSWD=secret
> LOCALDIR=/my/local/dir
>
> FILES=$(cd LOCALDIR ; ls *.txt)
> NFILES=$(echo $FILES |wc -w)
>
> cat <<EOF >myftp.cmd
> user $USER $PASSWD
> lcd /my/local/directory
> cd $LOCALDIR
> prompt off
> type ascii
> put myfile.txt myfile.txtnew
> chmod 644 myfile.txtnew
> rename myfile.txtnew myfile.txt
> quit
> EOF
>
> # The actual ftp
>
> ftp -nv <<myftp.cmd >myftp.log 2>myftp.err
>
> # some checking
>
> result=$(grep -c "^226" myftp.log)
> if [ $result -ne $NFILES ]
> then
>   echo "ftp failed"
>   exit -1
> fi
>
>


0
Reply GT 8/9/2003 2:09:58 AM

7 Replies
448 Views

(page loaded in 0.136 seconds)

Similiar Articles:













7/26/2012 3:03:55 PM


Reply: