I have a Windows server running Windows Server 2008 R2. I've set up an FTP site and a user account and I can connect to it and successfully download files using the Windows command-line FTP client from my machine at home.
I have a NAS running embedded Linux (BusyBox with FFP) and I've set up a cron job to run a script to mirror this FTP site down to the NAS. This script worked a few times but then I noticed that the data on disk wasn't getting updated, so I tried running the script from an SSH session. The output from the mirror command updates the console a couple of times saying "Getting directory contents" and then it errors with:
Unknown command `;'.
The script is as follows
#! /ffp/bin/bash
HOST='xxx.xxx.xxx.xxx'
USER='UserName'
PASS='Password'
TARGETFOLDER='/path/to/local/directory'
SOURCEFOLDER='.'
LOGNAME="$(date +%F-%H-%M-%S).log"
lftp -f "
open $HOST
user $USER $PASS
mirror -P 2 -n --log=$LOGNAME --verbose $SOURCEFOLDER $TARGETFOLDER
bye
"
LFTP is version 4.0.7.
The cause is the proably line break with user and mirror. If ftp client sends "\r\n" without entering any command, this can make issue with server, etc connection termination.