2

I'm using python paramiko, to connect to an SFTP portal. But, every time I run this code it fails with this error

paramiko.ssh_exception.AuthenticationException: Authentication failed.

This is the code I'm using:

import paramiko

host = 'https://sftp-portal.com'
port = 1022
username = 'username'
password = 'password!'

transport = paramiko.Transport((host,port))
transport.connect(None,username,password)
sftp = paramiko.SFTPClient.from_transport(transport)
sftp.get('/files/csv/example.csv', '/Users/User/Desktop')
sftp.close()

What am I doing wrong? any help with this is highly appreciated.

0

1 Answer 1

1

The "host" part of the tuple you pass to the Transport constructor is a "hostname", not a "URL":

host = 'sftp-portal.com'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.