Search code examples
phpsftp

"Could not authenticate with username and password" when trying to connect with SFTP


I am trying to establish connection using sftp class

my code:

$host = 'some ip address';
$username = 'username';
$pass = 'password';

$sftp = new SFTPConnection($host, 22);
$sftp->login($username, $pass);

When i run this script i get message Could not authenticate with username and password

When i use same user and pass in fileZilla with sftp, then is ok, I can establish connection, but with script i cant

Anyone know what is the problem?


Solution

  • Ok, here what was the problem...

    My IP address wasnt been allowed on FTP server?! Now when they put my IP on whitelist, everything working just fine.

    Thank you guys for your effort.