Loading ...
Sorry, an error occurred while loading the content.

Re: [LinkStation_General] Re: Need help with FTP shell script from linux -> LS Network Storage Center

Expand Messages
  • pfink
    ... Try this shell script: #!/bin/sh HOST= ftp.example.com USER= username PASSWD= password ftp -u $HOST
    Message 1 of 8 , Jun 3, 2006
    View Source
    • 0 Attachment
      mixed_mind_assistance wrote:
      >
      > I'm trying to FTP from Fedora Core 4.

      Try this shell script:

      #!/bin/sh
      HOST='ftp.example.com'
      USER='username'
      PASSWD='password'

      ftp -u $HOST <<END_SCRIPT
      quote USER $USER
      quote PASS $PASSWD
      bin
      hash
      cd /path/to/target/directory
      lcd /path/to/source/directory_of_files/getting_backed_up
      mput myfiles
      quit
      END_SCRIPT
      exit 0
    • mixed_mind_assistance
      ... I ll try that one again, but I *do* believe it fails ..
      Message 2 of 8 , Jun 3, 2006
      View Source
      • 0 Attachment
        --- In LinkStation_General@yahoogroups.com, pfink <pfink@...> wrote:
        >
        > mixed_mind_assistance wrote:
        > >
        > > I'm trying to FTP from Fedora Core 4.
        >
        > Try this shell script:
        >
        > #!/bin/sh
        > HOST='ftp.example.com'
        > USER='username'
        > PASSWD='password'
        >
        > ftp -u $HOST <<END_SCRIPT
        > quote USER $USER
        > quote PASS $PASSWD
        > bin
        > hash
        > cd /path/to/target/directory
        > lcd /path/to/source/directory_of_files/getting_backed_up
        > mput myfiles
        > quit
        > END_SCRIPT
        > exit 0
        >


        Thats the one I tried.. but I did not include this portion of the script:

        > ftp -u $HOST <<END_SCRIPT
        > quote USER $USER
        > quote PASS $PASSWD
        > bin
        > hash
        > cd /path/to/target/directory
        > lcd /path/to/source/directory_of_files/getting_backed_up
        > mput myfiles
        > quit
        > END_SCRIPT
        > exit 0
        >

        I'll try that one again, but I *do* believe it fails ..
      • pfink
        ... I just tested it on CentOS and it worked fine, should work on Fedora as well. The script you quoted didn t have the -u switch or the
        Message 3 of 8 , Jun 3, 2006
        View Source
        • 0 Attachment
          mixed_mind_assistance wrote:
          > --- In LinkStation_General@yahoogroups.com, pfink <pfink@...> wrote:
          >> mixed_mind_assistance wrote:
          >>> I'm trying to FTP from Fedora Core 4.
          >> Try this shell script:
          >>
          >> #!/bin/sh
          >> HOST='ftp.example.com'
          >> USER='username'
          >> PASSWD='password'
          >>
          >> ftp -u $HOST <<END_SCRIPT
          >> quote USER $USER
          >> quote PASS $PASSWD
          >> bin
          >> hash
          >> cd /path/to/target/directory
          >> lcd /path/to/source/directory_of_files/getting_backed_up
          >> mput myfiles
          >> quit
          >> END_SCRIPT
          >> exit 0
          >>
          >
          >
          > Thats the one I tried.. but I did not include this portion of the script:
          >
          >> ftp -u $HOST <<END_SCRIPT
          >> quote USER $USER
          >> quote PASS $PASSWD
          >> bin
          >> hash
          >> cd /path/to/target/directory
          >> lcd /path/to/source/directory_of_files/getting_backed_up
          >> mput myfiles
          >> quit
          >> END_SCRIPT
          >> exit 0


          I just tested it on CentOS and it worked fine, should work
          on Fedora as well.

          The script you quoted didn't have the "-u" switch or the
          <<END_SCRIPT / END_SCRIPT quoting, which are required.

          The "-u" switch stops the FTP client from attempting
          to authenticate immediately, which should prevent the
          Kerberos error. The login is then performed by the
          lines:

          quote USER $USER
          quote PASS $PASSWD
        • mixed_mind_assistance
          ... Hmm.. thats what I was just doing, so I tried doing scripting it differently since it fails on login. I did; ftp -u 192.x.x.x it connects to the box ftp
          Message 4 of 8 , Jun 3, 2006
          View Source
          • 0 Attachment
            --- In LinkStation_General@yahoogroups.com, pfink <pfink@...> wrote:
            >
            > mixed_mind_assistance wrote:
            > > --- In LinkStation_General@yahoogroups.com, pfink <pfink@> wrote:
            > >> mixed_mind_assistance wrote:
            > >>> I'm trying to FTP from Fedora Core 4.
            > >> Try this shell script:
            > >>
            > >> #!/bin/sh
            > >> HOST='ftp.example.com'
            > >> USER='username'
            > >> PASSWD='password'
            > >>
            > >> ftp -u $HOST <<END_SCRIPT
            > >> quote USER $USER
            > >> quote PASS $PASSWD
            > >> bin
            > >> hash
            > >> cd /path/to/target/directory
            > >> lcd /path/to/source/directory_of_files/getting_backed_up
            > >> mput myfiles
            > >> quit
            > >> END_SCRIPT
            > >> exit 0
            > >>
            > >
            > >
            > > Thats the one I tried.. but I did not include this portion of the
            script:
            > >
            > >> ftp -u $HOST <<END_SCRIPT
            > >> quote USER $USER
            > >> quote PASS $PASSWD
            > >> bin
            > >> hash
            > >> cd /path/to/target/directory
            > >> lcd /path/to/source/directory_of_files/getting_backed_up
            > >> mput myfiles
            > >> quit
            > >> END_SCRIPT
            > >> exit 0
            >
            >
            > I just tested it on CentOS and it worked fine, should work
            > on Fedora as well.
            >
            > The script you quoted didn't have the "-u" switch or the
            > <<END_SCRIPT / END_SCRIPT quoting, which are required.
            >
            > The "-u" switch stops the FTP client from attempting
            > to authenticate immediately, which should prevent the
            > Kerberos error. The login is then performed by the
            > lines:
            >
            > quote USER $USER
            > quote PASS $PASSWD
            >


            Hmm.. thats what I was just doing, so I tried doing scripting it
            differently since it fails on login.

            I did;

            ftp -u 192.x.x.x

            it connects to the box

            ftp>

            if you type user it prompts for a username and if you enter a username
            it prompts for password;

            Password:

            so if I scripted it like

            ftp -u 192.x.x.x
            user username
            mypassword

            it will not continue. Not sure why the script doesn't work, but it
            just fails on the authentication. I can do it manually without a problem.
          • mixed_mind_assistance
            I got it under control now, thanks for your help. I did find that script the other day, I think I know the cause of this. I m using SSH and had port 21 pointed
            Message 5 of 8 , Jun 3, 2006
            View Source
            • 0 Attachment
              I got it under control now, thanks for your help. I did find that
              script the other day, I think I know the cause of this. I'm using SSH
              and had port 21 pointed back to itself and that caused the errors. I
              forgot I forwarded port 21 back to the source IP, that is the cause of
              all the confusion.

              Its fixed now, ya that script will work.

              Thx again..
            Your message has been successfully submitted and would be delivered to recipients shortly.