skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.

    lftp -d -e "set ftp:ssl-allow yes;set ssl:verify-certificate true;set sftp:auto-confirm yes;ls;" -u 'xxx','xxx' -p 22 'sftp://xxxx'
    

  2. I took me a while to get it working, here is my solution:

    deploy:
      script:
        - apt-get update -qq && apt-get install -y -qq lftp
        - mkdir ~/.ssh/
        - ssh-keyscan -t rsa homexxxxxxx.1and1-data.host >> ~/.ssh/known_hosts
        - lftp -d -e "set ftp:ssl-allow yes;set ssl:verify-certificate true;set sftp:auto-confirm yes;ls;" -u $USERNAME,$PASSWORD -p 22 'sftp://homexxxxxxx.1and1-data.host' -e "mirror -e -R -x .git -p ./ ; quit"
      only:
        - master
    

    Without the line ssh-keyscan -t rsa homexxxxxxx.1and1-data.host >> ~/.ssh/known_hosts the gitlab runner was returning a host key verification failed error.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search