ftp-inband

[Explain this Expect demonstration script which acts a bit like a combination of ftp and ssh, how unbelievably useful it is, its man page, ...]

[mishandles case where receiver fills its filesystem?]


EE - I have an Expect program developed as part of the remote management of several hundred servers. This script has a list of remote servers to manage, and for each server, it starts and ssh session, logs in to the remote server, transfers a shell script, runs it, and captures the results. The shell script it transfers can do pretty much anything, so this can be used for things as diverse as adding or deleting a user, locking or unlocking an account, OS patching operations, gathering statistics from all servers, or software deployment/configuration, or security scanning/auditing. This Expect program transfers its shell script in exactly the same way as the ftp-inband example that comes with Expect. The method, step by step, is this:

  1. Locally, uuencode the file to be sent, into a temporary file.
  2. Send a remote command "cat > remote_temporary_file".
  3. Locally, read the temporary file.
  4. Send the uuencoded data to the remote end, where cat will receive the data and write it to the remote temporary file.
  5. send an EOF signal.
  6. Send a remote command "uudecode remote_temporary_file".

There is a potential failure here. When sending the uuencoded data to the remote end, if the filesystem holding the remote_temporary_file fills up, the cat will abort, and the remaining portion of the uuencoded data and the EOF signal will be received by the shell at the other end instead of the cat. When the shell received EOF, it will exit, and the next attempt to communicate with that session will cause a script error.

AMG: This reminds me of fish.