nforced
nforced

Reputation: 371

phpseclib Unable to request pseudo-terminal (SFTP)

include('Net/SFTP.php');

$sftp = new Net_SFTP($ftp_server,225);
if(!$sftp->login($ftp_user, $ftp_pass)){
 print_r($sftp->getErrors());
 exit('Login Failed');
}

I always get:

Notice: Unable to request pseudo-terminal in /www/asizi/lib/phpseclib/Net/SSH2.php on line 2239 
Notice: Connection closed prematurely in /www/asizi/lib/phpseclib/Net/SSH2.php on line 2347 
Array ( )
Login Failed

My login is correct, if I make it incorrect I get just: "Login Failed" with not errors/warnings

phpseclib version: 0.3.1

I can't pass $sftp->login();

Where do I go wrong?

Upvotes: 0

Views: 660

Answers (2)

Anand From Pie.host
Anand From Pie.host

Reputation: 1233

For me, this error occurred because I was calling exec in-between of a read and write session.

You can not call exec when emulating an interactive terminal session.

Upvotes: 0

user1469439
user1469439

Reputation:

What do the SSH logs say? Here's an example of how to get them:

http://phpseclib.sourceforge.net/ssh/examples.html#logging

Note the define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX); and the echo $ssh->getLog(); lines.

Thanks!

Upvotes: 1

Related Questions