我无法使用python ftplib登录vsftpd服务器

问题描述 投票:0回答:0

我已经使用 vsftpd 在 Debian 10 中设置了一个 ftp 服务器,并且可以使用 Total Commander 和终端成功连接到该服务器。

我尝试了所有的方法,但有些不起作用。我的问题是什么?

    ftp = FTP(host, username, password)
    print(ftp.login())

ftplib.error_perm: 530 Can't change to another user.

    ftp = FTP(host, '21')
    ftp.login(user=username, passwd=password)

ftplib.error_perm: 530 Login incorrect.

    ftp = FTP_TLS()
    ftp.set_debuglevel(2)
    print(ftp.connect(host, 21))
    print(ftp.sendcmd(username))
    print(ftp.sendcmd(password))

ftplib.error_perm: 530 Please login with USER and PASS.

import pysftp
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
with pysftp.Connection(
    host=host,
    port=21,
    username=username,
    password=password,
    cnopts=cnopts
    ) as sftp:
    print("Connection succesfully established ... ")

paramiko.ssh_exception.SSHException: Error reading SSH protocol banner

python ftp ftplib
© www.soinside.com 2019 - 2024. All rights reserved.