Page 1 of 1

SFTP Backup failed [SOLUTION]

Posted: Fri May 18, 2018 8:13 pm
by WhiteWind
Hi!

I have faced the errors with sftp backup script. It can't connect to the server if I run it manually, so I tried to see the code and found the error:

Code: Select all

# sftp command function
sftpc() {
    expect -f "-" <<EOF "$@"
        set timeout 60
        set count 0
        spawn /usr/bin/sftp -o StrictHostKeyChecking=no \
            -o Port=$PORT $USERNAME@$HOST
        expect {
            "password:" {
                send "$PASSWORD\r"
                exp_continue
            }
...
...            


In that function it waits for the "password:", but in the reality it receives "Password:" from my server (first letter is capital). May be it's just my server version, but I think you can fix this somehow ))

Re: SFTP Backup failed [SOLUTION]

Posted: Thu Sep 23, 2021 11:39 am
by jimmyeao
8 years on and this solved my issue, thank you :)