远程调用SHELL函数

function remoteRunShell($ip, $shell, $sysuser, $syspass) {
$connection = ssh2_connect($ip, 22);
if(!ssh2_auth_password($connection, $sysuser, $syspass)) {
return false;
}
$stream = ssh2_exec($connection, $shell);
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);
fclose($stream);
return $output;
}

This entry was posted in 学习笔记. Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已被标记为 *

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>