Supreeth Tamvada
Supreeth Tamvada

Reputation: 23

Paramiko authentication failed / authentication exception

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.

Upvotes: 2

Views: 1461

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202534

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

host = 'sftp-portal.com'

Upvotes: 1

Related Questions