I have a FTP server at Ionos.com which works good with Filezilla.
However, when i try to connect to this FTP server via LFTP on a gitlab public runner (node:latest image), i keep on receiving errors depending on what i’m doing :
Connecting on port 21:
lftp -d -e "set ftp:ssl-allow no;set ssl:verify-certificate false;set sftp:auto-confirm no;ls;" -u 'xxx','xxx' -p 21 'xxx'
---- Resolving host address...
---- 2 addresses found: xxx, xxx
---- Connecting to xxx (xxx) port 21
**** Socket error (Network is unreachable) - reconnecting
---- Closing control socket
---- Connecting to xxx (xxx) port 21
<--- 220 FTP Server ready.
---> FEAT
<--- 500 'FEAT': command unrecognized.
---> USER xxx
<--- 331 Password required for xxx
---> PASS xxx
<--- 530 Login incorrect.
---> PWD
ls: Login failed: 530 Login incorrect.
<--- 421 Service not available, closing control connection.
---> QUIT
<--- 530 Not logged in.
---- Closing control socket
Connecting on port 22:
lftp -d -e "set ftp:ssl-allow yes;set ssl:verify-certificate true;set sftp:auto-confirm yes;ls;" -u 'xxx','xxx' -p 22 'xxx'
---- Resolving host address...
---- 1 address found: xxx
---- Connecting to xxx (xxx) port 22
<--- SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u1~ui10+2
**** Peer closed connection
---- Closing control socket
The 4 last lines loop ad nauseam.
I already checked if credentials and server host are good by testing those on Filezilla.
Can someone help me ?
Thank you
2
Answers
The problem is that the FTP needs a SFTP connection.
In order for LFTP to connect in SFTP we need to use "sftp://" before the hostname.
I took me a while to get it working, here is my solution:
Without the line
ssh-keyscan -t rsa homexxxxxxx.1and1-data.host >> ~/.ssh/known_hosts
the gitlab runner was returning ahost key verification failed
error.