I want to sync a remote folder with a local folder using lftp.
When I installed the first time "lftp" and I created this script:
#!/bin/bash
#get username and password
USER=... #Your username
PASS=... #Your password
HOST="..." #Keep just the address
echo Sync started ...
LCD="/var/www/myfolder/app" #Your local directory
RCD="/app" #FTP server directory
lftp -f "
open $HOST
user $USER $PASS
lcd $LCD
mirror --continue --reverse --delete --no-symlinks --exclude .gitkeep --exclude .gitignore --exclude .bower.json --verbose $LCD $RCD
bye
"
Everything worked like a charm.
After that, I tried to compile lftp with SSL support (I downloaded the source, compiled in a deb package and installed it) to sync to an SSL FTP server. I did not figure out, but I did not need any more, so I wanted to come back to the start situation.
Now, even if I remove lftp and I install it again without SSL, when I execute the script I get this message:
mkdir `/app' [FEAT negotiation...]
The command just goes in timeout (I saw it with the debug). How can I solve it?
I have faced the exact same problem. It was resolved by explicitly providing a protocol prefix 'sftp' in the connection string. By default lftp uses 'ftp' as a protocol.
HOST="sftp://<hostname>" # <-- make sure that you have specified the protocol here
lftp <<EOF
set ssl:verify-certificate no
set sftp:auto-confirm yes
open $HOST -p $PORT -u $USER,$PASSWORD
mirror $RCD $LCD
EOF
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With