2

I'm trying to get my ftp log to include the commands I'm pushing in as well as the output it receives as the session proceeds. I have the following so far:

/bin/echo '***** START OF FTP PROCESS *****'
/bin/echo $datetime_stamp

ftp -v -n << EOF >> $FTP_LOG_FILE
open $FTP_SERVER
user $USERNAME $PASSWORD
asc
prompt no
ls -al
cd $FTP_DIRECTORY
ls -al
quit
EOF
/bin/echo '***** END OF FTP PROCESS *****'

However my log file is only showing the responses:

Connected to 10.125.0.122 (10.125.0.122).
220 Microsoft FTP Service
Remote system type is Windows_NT.
331 Password required
230 User logged in.
200 Type set to A.
Interactive mode off.
227 Entering Passive Mode (10,125,0,122,194,69).
125 Data connection already open; Transfer starting.
03-20-17  10:33AM       <DIR>          eMR_ABC
03-20-17  10:34AM       <DIR>          eMR_DEF
03-20-17  10:34AM       <DIR>          eMR_GHI
03-20-17  10:33AM       <DIR>          eMR_JKL
03-20-17  10:34AM       <DIR>          eMR_MNO
03-13-17  10:17AM       <DIR>          eMR_PQRS
03-20-17  10:33AM       <DIR>          eMR_TUV
226 Transfer complete.
250 CWD command successful.
227 Entering Passive Mode (10,125,0,122,194,70).
125 Data connection already open; Transfer starting.
226 Transfer complete.
221 Goodbye.

What I'd like it to do is show the commands being entered at the time each command is being processed.

For example:

Connected to 10.125.0.122 (10.125.0.122).
220 Microsoft FTP Service
Remote system type is Windows_NT.
331 Password required
user XXXX YYYY
230 User logged in.
asc
200 Type set to A.
prompt no
Interactive mode off.

and so on... Is there a way this can be done?

  • @Nasha: I'm a little clueless regarding determining which daemon I'm using... I know in this case I'm using /usr/bin/ftp, but beyond that I'm uncertain... And your assumption that i'm after timestamping is incorrect. I'm not after timestamping... What I need is the log to also display the commands being processed. I'll update my question to explain. – Eliseo d'Annunzio May 3 '17 at 3:02
  • @eliseo-dannunzio What you described is exactly time stamping by definition. I overlooked the hint that you seem to be working under Windows not a UNIX-like platform. On the latter, the system log prefixes all logged lines with the time logged lines were sent to the log, which the FTP daemon does as soon as it receives a command or responds. – user86969 May 3 '17 at 3:07
  • To know what fTP daemon you have, just type /usr/bin/ftp --version. At worst the program doesn't recognize that argument and spits out its command line syntax along with its version. – user86969 May 3 '17 at 3:08
  • Well, ignore my comment about time stamping. That said it's key to know what program and version you're using as your FTP server. – user86969 May 3 '17 at 3:15
  • @nasha Regrettably, I'm not even getting a version number. A call of /usr/bin/ftp --version provides the response ftp: -: unknown option. Even a call to the man page provides no mention of a version option, or any instance od a version number. The closest I've got are references of: "Linux netKit (0.17) August 15, 1999" and "The ftp command appeared in 4.2BSD." within the man page. I hope this helps? – Eliseo d'Annunzio May 3 '17 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.