Download files from FTP server: Exception: Error reading SSH protocol banner

前端 未结 1 986
無奈伤痛
無奈伤痛 2021-01-17 06:15

I want to download files from an FTP server (I have installed a test vsftpd server on Linux 14.04 lts, Python version 2.7.13, Paramiko version 2.2.1) using the following cod

相关标签:
1条回答
  • 2021-01-17 06:57

    Banner: 220 (vsFTPd 3.0.2) ...

    This means you are connecting to an FTP server.

    SSHException: Error reading SSH protocol banner

    This means you are expecting an SSH server not an FTP server.

    The reason for this confusion is that you are assuming that SFTP is just like FTP, but its not. These are completely different protocols. SFTP is file transfer on top of SSH while FTP is the 30+ year old protocol described in RFC959. And FTPS (not SFTP) is SSL support added to this old protocol.

    To access an FTP or FTPS server you can use ftplib in Python.
    To access your server with SFTP use port 22 (ssh) not port 21 (ftp) as target port, provided that there is an SSH server at this port which also allows SFTP.

    0 讨论(0)
提交回复
热议问题