[SOLVED] Using lftp to connect to a Bitwise SSH server.
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to use lftp with a script that would automatically log in an SSH server and download in multipart mode all the files that are situated on 2 given directories. The names and the number of the files is unknown. I'm running lftp on Windows, but since it's originally a Linux utility and uses the same syntax, I hope to find some useful advice here.
The server is a Bitwise SSH server.
Let's say that the server MyPC is foo.dynu.com, the port is 9999, the username MyUser and the password MyPass. The Server is configured to only accept the use of a key pair, logging with only the username and password is rejected.
If I use CrossFT to log in, the Bitwiser server log shows (note that the user name, password, IPs and ports have been changed to random values):
debug 10
set sftp:connect-program "ssh -a -x -i D:/m1/.ssh/id_rsaNoPass.ppk"
open MyUser,MyPass@foo.dynu.com:9999
cd /d/caps
cat *
and I get on the terminal:
Code:
nt{lftp}% lftp test
D:/m1/soft/l/lftp/lftp-4.7.5.win64-openssl/bin/lftp.exe -f test
Password:
---- Resolving host address...
buffer: EOF on FD 5
---- 1 address found: 222.22.222.222
---- dns cache hit
---- attempt number 1 (max_retries=1000)
---- Connecting to foo.dynu.com (222.22.222.222) port 9999
<--- SSH-2.0-5.21 FlowSsh: Bitvise SSH Server (WinSSHD) 6.03: free only for personal non-commercial use
buffer: EOF on FD 5
<--- !!!T!!!!!!,BssLoginTimeout: user authentication timeout!!!!¦¦¦¦-¦?w¦%¦¦S¦¦¦N¦J?G¦¦
**** Peer closed connection
---- Closing control socket
---- dns cache hit
---- attempt number 2 (max_retries=1000)
---- Connecting to foo.dynu.com (222.22.222.222) port 9999
<--- SSH-2.0-5.21 FlowSsh: Bitvise SSH Server (WinSSHD) 6.03: free only for personal non-commercial use
cd `/d/caps' [FEAT negotiation...]
- lftp asks for a password. But the private key does not need a passphrase, and the user password is provided in the script. So, what is this password asked for?
- the server acknowledges the connection, so it's not a firewall problem. But then, it stalls, there is no key pair authentication.
I'm trying to use lftp with a script that would automatically log in an SSH server and download in multipart mode all the files that are situated on 2 given directories. The names and the number of the files is unknown. I'm running lftp on Windows, but since it's originally a Linux utility and uses the same syntax, I hope to find some useful advice here.
The server is a Bitwise SSH server.
Let's say that the server MyPC is foo.dynu.com, the port is 9999, the username MyUser and the password MyPass. The Server is configured to only accept the use of a key pair, logging with only the username and password is rejected.
If I use CrossFT to log in, the Bitwiser server log shows (note that the user name, password, IPs and ports have been changed to random values):
debug 10
set sftp:connect-program "ssh -a -x -i D:/m1/.ssh/id_rsaNoPass.ppk"
open MyUser,MyPass@foo.dynu.com:9999
cd /d/caps
cat *
and I get on the terminal:
Code:
nt{lftp}% lftp test
D:/m1/soft/l/lftp/lftp-4.7.5.win64-openssl/bin/lftp.exe -f test
Password:
---- Resolving host address...
buffer: EOF on FD 5
---- 1 address found: 222.22.222.222
---- dns cache hit
---- attempt number 1 (max_retries=1000)
---- Connecting to foo.dynu.com (222.22.222.222) port 9999
<--- SSH-2.0-5.21 FlowSsh: Bitvise SSH Server (WinSSHD) 6.03: free only for personal non-commercial use
buffer: EOF on FD 5
<--- !!!T!!!!!!,BssLoginTimeout: user authentication timeout!!!!¦¦¦¦-¦?w¦%¦¦S¦¦¦N¦J?G¦¦
**** Peer closed connection
---- Closing control socket
---- dns cache hit
---- attempt number 2 (max_retries=1000)
---- Connecting to foo.dynu.com (222.22.222.222) port 9999
<--- SSH-2.0-5.21 FlowSsh: Bitvise SSH Server (WinSSHD) 6.03: free only for personal non-commercial use
cd `/d/caps' [FEAT negotiation...]
- lftp asks for a password. But the private key does not need a passphrase, and the user password is provided in the script. So, what is this password asked for?
- the server acknowledges the connection, so it's not a firewall problem. But then, it stalls, there is no key pair authentication.
What am I missing?
Not sure what you are missing, but when keys are involved I pass the logon name and password on the command line. It is critical to know if anyone else can log in and see the process list, as this exposes the name and password in the process list.
In these cases, by the way, sftp behavior and lftp behavior are quite different. Lftp may delay authentication on the remote server until it needs a folder or file list, or otherwise actually needs to transfer data. SFTP does the authentication up front.
Try this manually first, before turning it over to a script, so you get a chance to observe and troubleshoot during the dialog.
I use primarily windows tools on windows (putty and winscp), and use cygwin for xwindows integration etc.
Everything I have done in cygwin has pretty much worked as if it were running under linux, but there are path restrictions and differences. I would look into why it thinks it should create that folder, and why it cannot.
Meanwhile, I might find another way to do the transfer. This is only ONE way, and there are many more tools than lftp!
I tried an older version, 4.4.15 32 bits instead if the current (Windows) 4.4.17 64 bits, and it works nicely.
In case anybody is interested, here is a working script on Windows:
Code:
set sftp:connect-program 'D:/m1/soft/L/lftp/lftp/bin/ssh.exe -v -a -x -i id_rsaNP'
open sftp://MyUser:dummy@foo.dynu.com:9999
cd /d/caps
set mirror:use-pget-n 8
mirror /d/caps /cygdrive/d/caps
Meanwhile, I might find another way to do the transfer. This is only ONE way, and there are many more tools than lftp!
Windows clients that can do multi-part transfers are not very good. The best is CrossFTP, who makes a bunch of small files, and then rejoin them, which is a waste fo time.
lftp creates a large file from the get go, and then fills it. That's the main reason I wanted to try it.
I tried an older version, 4.4.15 32 bits instead if the current (Windows) 4.4.17 64 bits, and it works nicely.
In case anybody is interested, here is a working script on Windows:
Code:
set sftp:connect-program 'D:/m1/soft/L/lftp/lftp/bin/ssh.exe -v -a -x -i id_rsaNP'
open sftp://MyUser:dummy@foo.dynu.com:9999
cd /d/caps
set mirror:use-pget-n 8
mirror /d/caps /cygdrive/d/caps
Ahaa! Do you think that you tripped over a bit-width code issue? I had not heard of one, but this is interesting. I may try it myself to see if I can replicate the behavior. meanwile, you might want to mark the threadsolvedso others will be able to find this solutions!
Ahaa! Do you think that you tripped over a bit-width code issue? I had not heard of one, but this is interesting. I may try it myself to see if I can replicate the behavior.
I tested the 64 bit 4.4.15 version, and it works too, so it's a bug in 4.7.7.
Quote:
meanwile, you might want to mark the threadsolvedso others will be able to find this solutions!
Done.
That said, CrossFTP appears to be better overall: I reach 16 MBs with it, while it peaks at 10 with lftp. So, despite a better way to handle multi-part, lftp takes more time to download large files.
Wonderful! I am not sure I ever saw anyone advance lftp for speed. It is a great tool for transfer automation, and handles MANY protocols, but it may not be as fast as a dedicated tool that does or checks less. I never tested performance for lftp.
Wonderful! I am not sure I ever saw anyone advance lftp for speed. It is a great tool for transfer automation, and handles MANY protocols, but it may not be as fast as a dedicated tool that does or checks less. I never tested performance for lftp.
Very glad you solved this!
Every SFTP client I tried on Windows runs at max at 1.5MBs (that's lftp speed) by connection, despite the fact that I have a Gb FTTH connection. Filezilla maxes out at .5MBs.
So, segmented downloads are the only way to get speed, and I found only a few clients that support that:
- Bitkinex (I think), but it's unusable on a high res monitor due to its use of tiny fonts.
- SmartFTP. But it uses an incredibly bloated UI, and does something to the Bitwise server that often leaves it on a loop at 100% cpu. Also, it requires to install a Microsoft patch on Windows 7 that prevents the Windows Resource Monitor to work.
- CrossFTP, which is ok but annoying in the way it creates multiple small files before joining them.
lftp with 32 connections works the best, but 32 simultaneous accesses is too much for a regular hard drive, so it needs an SSD.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.