I'm using lftp to connect to an sftp server but I get a "no matching ciphers" error, and need to specify which cipher is used.

Using sftp the command to connect would look like this:

sftp -c aes256-cbc sftp://sftpserver:10

How can I connect with that cipher using lftp? I can't find anything about ciphers or how to specify which encryption to use and let lftp pass it to ssh. I'm looking for something similar to sftp's option -o that passes and option to ssh.

  • 1
    Doesn't the error say that there's no cipher that the lftp and the server can agree upon? You may need to upgrade the lftp or the server. Or what exactly is the behaviour of sftp without the -c aes256-cbc? Commented Feb 15, 2021 at 13:18
  • Without the -c-switch sftp I can't connect, but I get a message saying "Their offer" includes aes256-cbc, and when I specify the switch it works. I guess you're wondering why sftp does't use that cipher directly? I have no idea ... Commented Feb 16, 2021 at 14:56

2 Answers 2


Read man lftp and see set sftp:connect-program. Here's my example (a shell wrapper around lftp) from which you can get idea how to use it, in my case I used lftp to sftp via a jumpbox.

sshargs="ssh -F ${tmpdir}/.ssh/config -J "

export LFTP_HOME=${tmpdir}
cat > ${tmpdir}/rc <<EOF
set sftp:connect-program ${sshargs}

lftp -c "
open -u ${WEBSERVER_USER},whatever sftp://${WEBSERVER_HOST}${DEST_DIR}
cd ${SRC_DIR} && mirror --dry-run -R --ignore-size -L --no-perms --no-umask

For interactive operations, you can just type this as your first command inside lftp:

set sftp:connect-program "ssh -c aes256-cbc"

Alternatively you can store this command in an rc file to load automatically, such as here: ~/.config/lftp/rc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .