ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

FTP to SFTP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • FTP to SFTP

    I have some programs that run FTP scripts to drop off and pick up some files to/from a LINUX server. Suddenly, they (vendor who hosts server) have said they're shutting off FTP and want me to use SFTP (port 22) instead. In my scripts, I don't even specify a port (only an IP address), but I guess it's defaulting to port 21 (?). Anyway, here are a couple examples of simple FTP scripts currently running happily (they are run by CL and RPG programs). What do I need to do in order to have them use SFTP instead? I don't suppose it's as easy as adding :22 to the end of the IP address...?

    This one gets a list of files to pick up:

    Code:
    OPEN 'xx.xxx.xxx.xx'
    USER myftpuser myftppwd
    ASCII
    Namefmt 1
    SENDEPSV 0
    LS (Disk
    CLOSE
    QUIT
    This one picks up a file:

    Code:
    OPEN 'xx.xxx.xxx.xx'
    USER myftpuser myftppwd
    ASCII
    Namefmt 1
    SENDEPSV 0
    lcd /ecommerce/inbound
    GET myfile.csv
    RENAME myfile.csv myfile.old
    CLOSE
    QUIT
    This one drops off a file:

    Code:
    OPEN 'xx.xxx.xxx.xx'
    USER myftpuser myftppwd
    Namefmt 1
    SENDEPSV 0
    lcd /ecommerce/outbound
    MPUT shipments*.csv
    CLOSE
    QUIT
    They just notified me today and want to make the change today... yikes.

    Thanks.

  • #2
    Re: FTP to SFTP

    You won't get it done today. You've got some work ahead of you.

    Start with this information from Scott Klement.

    Comment


    • #3
      Re: FTP to SFTP

      That is a lot of info and looks to completely change the entire approach to picking up and dropping off some files... I didn't understand all that much on first run-through, but much seems to pertain to being a server, doesn't it?

      Comment


      • #4
        Re: FTP to SFTP

        It is not a simple change, especially the first time around. Had a vendor do a similar thing, gave me a week to figure it out. Not sure what you mean by being a server, I guess in that aspect it is similar. You are still the client getting files from their server.

        The only similarities between ftp and sftp is the name and some of the commands. If you get desperate you can just use leech ftp and that will connect right up, but that would just make more work for you.

        Comment


        • #5
          Re: FTP to SFTP

          Originally posted by Viking View Post
          much seems to pertain to being a server, doesn't it?
          I probably don't understand your question, Viking. The Linux system will still be the server and you'll still be the client.

          Contact me thru the contacts page at itjungle.com and I'll give you some more information that might help.

          Comment


          • #6
            Re: FTP to SFTP

            May also want to consider Arpeggio's ARSFTP product, especially if you need to get this done quickly.

            It's very easy to set up and use - basically right from a CL program, and they provide sample code.

            Cheers,

            Emmanuel

            Comment


            • #7
              Re: FTP to SFTP

              I was able to do this... I went off of this link...
              http://www-01.ibm.com/support/docvie...d=nas8N1012710

              My CL program was something like this
              Code:
              qsh        cmd('sftp -b /location/to/script/script.sftp +
                           userid@serverip')
              In the script I have something like this
              Code:
              cd /location/of/files/                
              -mget *.txt /local/file/location/
              -mget *.dat /local/file/location/
              exit
              Then you adapt the CL/RPG code to handle a directory full of files...

              Comment


              • #8
                Re: FTP to SFTP

                That presentation covers a wide variety of topics related to SSH... it's not focused purely on SFTP. It describes how to use the PASE shell, how to setup and run an sshd server, how to use secure copy (scp), how to do interative SSH logons and tunnelling, how to setup digital keys... and finally, it also describes SFTP, etc.

                if you're only interested in sftp, maybe you want to skip to slide #31.

                There's also more information on my web site than just that presentation. See here:

                Comment

                Working...
                X