I am trying to connect to a public FTP server using Paramiko. Since the FTP server is public it don't have username and password. So I run following commands:
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
trans = paramiko.Transport(("ftp.***.com", 22))
trans.connect()
But I am getting error in executing the last command.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/userstar713/workspace/work/serverless/python/ftp-s3-sls/venv/lib/python3.6/site-packages/paramiko/transport.py", line 1291, in connect
self.start_client()
File "/home/userstar713/workspace/work/serverless/python/ftp-s3-sls/venv/lib/python3.6/site-packages/paramiko/transport.py", line 660, in start_client
raise e
File "/home/userstar713/workspace/work/serverless/python/ftp-s3-sls/venv/lib/python3.6/site-packages/paramiko/transport.py", line 2039, in run
self._check_banner()
File "/home/userstar713/workspace/work/serverless/python/ftp-s3-sls/venv/lib/python3.6/site-packages/paramiko/transport.py", line 2216, in _check_banner
"Error reading SSH protocol banner" + str(e)
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
Please give me suggestion. Thanks
Paramiko is an SFTP library, not FTP library. SFTP servers that do not require any credentials are almost non-existent. And even the error message you are getting suggests that you are not connecting to an SFTP server.
If it is indeed an FTP server, you need to use an FTP library, like ftplib .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.