SFTP Backup failed [SOLUTION]
Posted: Fri May 18, 2018 8:13 pm
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:
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 ))
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 ))