Reputation: 41458
I'm trying to connect to a SFTP server via a simple script, after looking on the web I found that expect
might be something to look at, but for some reason I just can't make it work at all.
Here is the sample script I've created:
#!/usr/bin/expect
spawn sftp [email protected]
expect "password:"
send "mypassword";
interact
When I execute this it still asks me for my password for some reason, even if I did send it:
>$ ./connect-ftp.sh
spawn sftp [email protected]
Connecting to myftp.mydomain.com...
[email protected]'s password:
Does someone have any clue as to why I can't get expect working as I want?
Upvotes: 0
Views: 2940
Reputation: 61459
You aren't sending a carriage return after the password.
send "mypassword\r"
Upvotes: 2