简体   繁体   中英

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?

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM