I am trying to transfer files via sftp with password mode but getting below message
content of file put-script

 open sftp://user:password@host  
 get /tmp/testftp.txt  


 $ lftp -f put-script  
/tmp/testftp.txt' at 0 [Delaying before reconnect: 29]    

Please help


That script might be made to work (but the manual page does not hint that it would accept the user and password in that manner).

What works for me is to factor out the user/password like this:

lftp -u user,password -e "command"

But I am using that with a private key, by setting options at the beginning of the command to use a given mykeyfile (which one could use in a script):

set ftp:ssl-allow yes
set ssl:key-file mykeyfile
set ftp:ssl-force true;

since private keys are generally preferable. For that case, lftp ignores the given password on the command (but it must be given, to appease its command-parser).

| improve this answer | |
  • I did lftp -u User,password lftp batch@:~> set ftp:ssl-force true; lftp batch@:~> get /tmp/testftp.txt But I got `/tmp/testftp.txt' at 0 And this remained on the screen for a long time (Until I did ctrl+C) – anurag Feb 9 '16 at 11:30
  • If you have not put your public key on the server, it will hang. – Thomas Dickey Feb 9 '16 at 22:10

I have changed the value of requiredpasswordauthentication to "Yes" in sshd configuration and then rebooted the service. Now I am able to do sftp via password.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.