A ftp script - Minix

This is a discussion on A ftp script - Minix ; I' ve written a simple script to make the downloading of the fil from a server to my minix machine fast and easy. This script doesn't work, after the authentication it seems the server doesn't accept the commands ls and ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: A ftp script

  1. A ftp script

    I' ve written a simple script to
    make the downloading of the fil from a server to my minix machine fast
    and easy.
    This script doesn't work, after the authentication it seems the
    server doesn't accept the commands ls and cd (I got
    the message You must log in first even if I logged in successfully)
    here's the script:

    #!/bin/sh

    filename="Faun.pdf"
    hostname="x.x.x.x"
    username="domenik"
    password="pippo"
    path="minix_modified"
    START=$(date +%s)
    ftp $hostname < quote USER $username
    quote PASS $password
    cd $path
    get $filename
    quit
    EOF
    END=$(date +%s)
    DIFF=$(($END-$START))
    echo $DIFF

  2. Re: A ftp script

    puntino wrote:

    > ftp $hostname <

    You have to use "ftp -n" to prevent the FTP client from prompting for
    authentication.

    Regards,

    Jens

    --
    Jens de Smit
    Student Computer Science | Vrije Universiteit Amsterdam
    jfdsmit@few.vu.nl | http://www.few.vu.nl/~jfdsmit
    "[In the end, people] get furious at IT that the goddamn magic isn't working"
    -- Stewart Dean

  3. Re: A ftp script


    >
    > You have to use "ftp -n" to prevent the FTP client from prompting for
    > authentication.


    I deleted the option "n" because I got the error message
    Unresolved host -n
    Memory fault core dumperd.

    Without the option "n", After the authentication, when
    I wat to execute the command "cd %path" I receive from the server
    the message: You must login first. and this is my problem

  4. Re: A ftp script

    "puntino" wrote ...
    > I' ve written a simple script to make
    > the downloading of a file from a server
    > to my Minix machine fast and easy.
    > That script doesn't work; after the authentication, it seems the
    > server doesn't accept the commands ls and cd (I got
    > the message, "You must log in first" -- even if I logged in
    > successfully)! here's the script:
    >
    > #!/bin/sh
    >
    > filename="Faun.pdf"
    > hostname="x.x.x.x"
    > username="domenik"
    > password="pippo"
    > path="minix_modified"
    > START=$(date +%s)
    > ftp $hostname < > quote USER $username
    > quote PASS $password
    > cd $path
    > get $filename
    > quit
    > EOF
    > END=$(date +%s)
    > DIFF=$(($END-$START))
    > echo $DIFF


    Don't use the "quote" command. It bypasses the FTP client. You logged into
    the server, but the FTP program didn't know about it (that error-message
    came from the client, not the server). Use the commands "user" and "pass"
    directly. Ftp knows when it's input was redirected; therefore, it won't ask
    for the user-name and password.