« Measuring the Miles to Homesteading's End | Main | Local advice guided bets for 3000 users »

July 06, 2018

Using MPE/iX to send SFTP files

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?

Allegro'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 our 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.

To configure for 'DNS lite' it's probably simplest to do the following

1. copy hostsamp.net to hosts.net

2. edit hosts.net to make sure it has

127.0.0.1 loopback
1.2.3.4   name    <--- where 1.2.3.4 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 '1.2.3.4')

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)

cat FTPT0070
open ftpserver.site.co.uk
user USERNAME PASSWORD
ascii
get /export/002_iccm_extract_1161.csv ICR21161

quit

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.

cat FTPS0070

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.
221 Goodbye.

In particular, the 3-digit status codes were analyzed, 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 Java, 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 FTP). I've found it way easier than to fiddle with files with text files containing commands, especially when it comes to error handling.

04:15 PM in Hidden Value | Permalink

Bookmark and Share

Use our search engine to find 20 years
of HP 3000 news and articles

Comments

Comments

The comments to this entry are closed.