Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
LOGNAME="$(date +%F-%H-%M-%S).log"
lftp -f "
open $HOST
user $USER $PASS
mirror -P 2 -n --log=$LOGNAME --verbose $SOURCEFOLDER $TARGETFOLDER

LFTP is version 4.0.7.

share|improve this question

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.

share|improve this answer
I've removed the blank line and I still get the same error. – Greg B Jul 26 '12 at 18:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.