'"Unable to request pty" PHP - rsync
I want to connect via SSH2 and transfer files with rsync but I get the following error. What could be the reason for this?
$ssh = new SSH2('storage.example.com');
if (!$ssh->login('username', 'helloWorld')) {
exit('Login Failed');
} else {
echo "asdas";
}
$ssh->exec("rsync --progress --rsh='ssh -p23' --recursive /var/.../backups [email protected]:backupsForProjects/april_2022/");
$output = $ssh->read('#[pP]assword[^:]*:#', SSH2::READ_REGEX);
if (preg_match('#[pP]assword[^:]*:#', $output)) {
$ssh->write("HeLLoPaSSwoRD\n");
}
Error:
Fatal error: Uncaught RuntimeException: Unable to request pty in /var/www/***/web/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php:3000 Stack trace: #0 /var/www/***/web/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php(3118): phpseclib3\Net\SSH2->initShell() #1 /var/www/***/web/test2.php(13): phpseclib3\Net\SSH2->read() #2 /var/www/***/web/index.php(118): include('/var/www/client...') #3 {main} thrown in /var/www/***/web/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php on line 3000
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
