Midrange News for the IBM i Community


Posted by: Viking
Information Systems
CA
FTP to SFTP
has no ratings.
Published: 12 Mar 2015
Revised: 12 Mar 2015 - 3346 days ago
Last viewed on: 09 May 2024 (4150 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

FTP to SFTP Published by: Viking on 12 Mar 2015 view comments(1)

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:

OPEN 'xx.xxx.xxx.xx'
USER myftpuser myftppwd
ASCII
Namefmt 1
SENDEPSV 0
LS (Disk
CLOSE
QUIT

This one picks up a file:

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:

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.

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: FTP to SFTP
Posted: 9 years 2 months 5 hours 7 minutes ago
Edited: Thu, 12 Mar, 2015 at 15:03:57 (3346 days ago)

The PORT arguement is on the FTP CL command.  FTP RMTSYS(xxxxx) PORT(22)

For SSH FTP (vs SSL FTP) you may want to read this article in IBM Systems Mag.