Table of Contents

Name

ftp2dos - ERP file transfer between linux and dos using ncftp

Synopsis

ftp2dos dos_machine, or just

dos_machine

where dos_machine is one of:


  B_DIG
  B_STIM
  W_DIG
  W_STIM
  G_DIG
  G_STIM
  EYE_DIG
  STIM1
  STIM2
  STIM3
  SERVER

Note that dos_machine must first be placed in server mode by entering the command "server" (see below).

Description

This script is meant to ease file transfer between the dos and linux machines in the Kutas lab. It uses an implementation of the ncftp program, and has several advantages over other file transfer methods: it reports when a file is about to be overwritten and prompts first for a course of action; it defaults to a transfer type of binary so data files can be transferred without having to remember to set the transfer type to binary; transfers are reliable, unlike some instances when using the dos ftp program; transfers are reasonably fast, unlike the dos secure-ftp program; end-of-line conversions are peformed on text files when the transfer type is set to ascii; and linux password and account names are not required, obviating the security risk of sending unencrypted passwords over the network.

This method is distinctly different from the standard dos ftp transfer in that the transfer takes place at a linux machine, and requires a little legwork in that the user must first put the target dos machine in server mode, then walk to a linux machine to perform the file transfer, then when done walk back to the dos machine to take it out of server mode.

The ncftp program handles the actual file transfer. ncftp commands are almost identical to ftp commands, for a summary enter the command ’help’ at the ncftp prompt, or see ’man ncftp’ for complete information. Anyone familiar with ftp commands should have no problem with ncftp.

Ascii or Binary?

In general, set the file transfer type to ’ascii’ when transferring text files, and ’binary’ when transferring binary files. Binary is the default.

The difference between transfer types ’ascii’ and ’binary’ is simply a matter of whether or not the file is converted during transfer. When the transfer type is set to ’ascii’ a conversion called end-of-line translation is performed on the file as it is transferred; when the transfer type is set to ’binary’ no conversion is performed. End-of-line translation is often desireable when transferring text files because the invisible end-of-line control characters are automatically converted to the convention used by the destination machine (the DOS end-of-line is two characters, a CR followed by LF, or hex 0d 0a; the linux end-of-line is the single character LF, or hex 0a).

The transfer type is set by entering either ’ascii’ or ’binary’ at the ncftp prompt; to check the current setting, enter ’type’.

Always use a transfer type of ’binary’ to transfer binary files like .crw and .log files because they should be transferred as-is with no translation. Never use type ’ascii’ to transfer binary files because some of the characters in them may coincidentally correspond to end-of-line characters and be translated, resulting in a destination file that is different from the source file.

It is preferable to transfer text files like scenario files using a transfer type of ’ascii’ so that end-of-line translation is performed appropriately. Note that when doing so the destination file may be a slightly different size than the source file, which is to be expected due to the changes in the number of end-of-line characters. It is OK to transfer text files using type ’binary’, but no end-of-line translation will be done and the destination file will likely appear strangely formatted on the destination machine.

Example

To transfer files between the dos machine B_DIG and a linux account, first put B_DIG in server mode by entering ’server’ at the dos prompt:

D:\EXPT2> server

Then, from any linux machine, open a connection to B_DIG by entering its name (each dos machine should have its name displayed on its monitor, note they are all in upper case):

mk12:~$ B_DIG
NcFTP 3.0.2 (October 19, 2000) by Mike Gleason (ncftp@ncftp.com).
Connecting to 172.16.6.105...
PC Resident FTP 2.2TN/TC-D server, ready
Logging in...
User logged in
Logged in to B_DIG.
ncftp D:/EXPT2 >

Use get/put/mget/mput to perform the desired file transfer(s), then enter ’quit’ when done:

ncftp D:/EXPT2 > get sub11.log
sub11.log: 24384 bytes 809.84 kB/s
ncftp D:/EXPT2 > quit

**************************************************************

PLEASE GO BACK TO B_DIG AND PRESS ESC
TO TAKE IT OUT OF SERVER MODE

**************************************************************

On exit a reminder is displayed to take the dos machine out of server mode (by pressing ESC). It is somewhat important to do this, otherwise the dos machine is left indefinitely in an insecure state waiting for connections. The risk that a hacker could or would tamper with it is low, but the risk does exist while the machine is in server mode.

See Also

ncftp(1)

Author

Paul Krewski


Table of Contents