How to Shift a 3000 from FTP to SFTP
April 30, 2013
I have a script that uses FTP to send files to a site which we open by IP address. We've been asked to change to SFTP (port 22) and use the DNS name instead of an IP address, and I don't believe the 3000 supports that. Does it? If so, how?
Allego's Donna Hofmeister replies:
I'm not sure you want to do SFTP on port 22. That's the SSH port. SFTP is meant to use port 115. Have a look at one of Allegro's white papers on how to do SFTP on MPE
If you are going to use DNS, you must have your 3000 configured for that. It's easily done.
However, if you've never done anything on your 3000 to make it act like a real computer (oh -- that's right, it is a real computer and fully capable of using DNS), this can turn into a can o'worms.
For 'DNS lite', it's probably simplest to:
1. copy hostsamp.net to hosts.net
2. edit hosts.net to make sure it has
22.214.171.124 name <--- where 126.96.36.199 and name are corrected to the system you want to connect to
3. copy the NSSWSAMP.net to nsswitch.net
4. edit nsswitch.net to have this line:
hosts : files[SUCCESS=return NOTFOUND=continue]
With this done, the 3000 sorta kinda acts like it's using DNS (because it's looking the the hosts file for how to translate 'name' into '188.8.131.52')
Tony Summers provides a caveat:
One warning. The upgrade from FTP to sFTP (or SSH FTP etc) can involve more change to your scripts that you expect. What we do for FTP (originally on the HP 3000, and now on our HP-UX server) is build a text file with the commands (the sample below, edited)
user USERNAME PASSWORD
get /export/002_iccm_extract_1161.csv ICR21161
The file is then presented to the FTP client. On the HP 3000 it was something like....
RUN FTP.ARPA.SYS < FTPT0070 > FTPS0070
Then both the output file, FTPS0070, and any JCWs set by the FTP program were inspected to test the success of the FTP session.
Connected to xxxxxx.co.uk
220 Welcome to FTP service - xxxx.
331 Please specify the password.
230 Login successful.
200 Switching to ASCII mode.
200 PORT command successful. Consider using PASV. 550 Failed to open file.
In particular, the 3-digit status codes were analysed, looking for error codes like "550".If you do something similar in your FTP scripts, then all I can say is welcome to a very different world.
Karsten Brøndum adds:
Here's a completely different approach.
Depending on your skills in the Java area there is a nice LPGL package called ftp4j that I have used a couple of times. (By the way, ftp4j will do both SFTP and FTPS). I've found it way easier than to fiddle with files with text files containing commands, especially when it comes to error handling.