RHEL에서 SLES 시스템으로 ssh를 보내려고합니다. 나는 그것을 달성하기 위해 PHP 함수 ssh2를 사용하고있다. 올바른 사용자 이름과 암호를 전달한 후에도 인증이 수행되지 않습니다. 그러나 동일한 코드가 RHEL-> RHEL에서 잘 작동합니다. RHEL 터미널에서 SLES 시스템으로 ssh 연결할 수 있습니다. 하지만 ssh2를 사용하는 것은 일어나지 않습니다.ssh2가 suse 용으로 작동하지 않습니다.
<?php
if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
// log in at ip on port 22
if(!($con = ssh2_connect(ip, 22))){
echo "fail: unable to establish connection\n";
} else {
// try to authenticate with username root, password password
if(!ssh2_auth_password($con, "root", "password")) {
echo "fail: unable to authenticate\n";
} else {
// allright, we're in!
echo "okay: logged in...\n";
// execute a command
if (!($stream = ssh2_exec($con, 'date'))) {
echo "fail: unable to execute command\n";
} else {
// collect returning data from command
//echo "in else";
stream_set_blocking($stream, true);
$data = "";
while ($buf = fread($stream,4096)) {
$data .= $buf;
}
echo $data;
fclose($stream);
}
}
}
?>
출력이 "실패 : 인증 할 수 없습니다."가 표시됩니다. 왜 그런 식으로 일어나는거야? 그것에 어떤 해결책?
다음
는 PECL 설치 할 YAST를 사용하여 libssh2-(STABLE)을 설치 :)하지만 난 여전히 SSH2는 RHEL- 작동하지 않는 이유> SLES를 파악 couldnt한다. 어쨌든 감사합니다 :) – Akshatha