- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的Cygwin和sshd工作正常。使用腻子根本没有问题。即使对多个命令,它也会按预期响应。但是,当使用phpseclib时,仅会收到第一个命令的响应。后续命令给出空白答复。
这是我要执行的脚本-
<?php
include('Net/SSH2.php');
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
$host = "XXXX";
$username = "XXXX";
$password = "XXXX";
$ssh = new Net_SSH2($host);
if (!$ssh->login($username, $password)) {
exit('Login Failed');
}
echo $ssh->exec('nproc');
echo $ssh->exec('nproc');
echo $ssh->getLog();
?>
最佳答案
我找到了解决方案-
问题的原因在于,在基于Windows的系统中,在执行新命令之前会调用setuid。对于第一个命令,其最初设置为没有问题。但是,随后的调用导致尝试重新分配它,并且失败,openssh将无法执行它。 ssh-host-config脚本中已经对此进行了解释-
*** Info: You appear to be running Windows XP 64bit, Windows 2003 Server,
*** Info: or later. On these systems, it's not possible to use the LocalSystem
*** Info: account for services that can change the user id without an
*** Info: explicit password (such as passwordless logins [e.g. public key
*** Info: authentication] via sshd).
*** Info: If you want to enable that functionality, it's required to create
*** Info: a new account with special privileges (unless a similar account
*** Info: already exists). This account is then used to run these special
*** Info: servers.
*** Info: The sshd service has been installed under the 'cyg_server'
*** Info: account. To start the service now, call `net start sshd' or
*** Info: `cygrunsrv -S sshd'. Otherwise, it will start automatically
*** Info: after the next reboot.
关于ssh - Cygwin OpenSSH服务器从PHP发出第一个命令后不响应(使用phpseclib),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28250370/
我不确定这是我做错了什么,还是服务器不支持 phpseclib 或什么,但我正在尝试连接到只接受安全 FTP 连接的 FTP 服务器,并且只接受某些 IP 地址。现在我知道 FTP 服务器接受来自我的
我想通过 php 添加 ssh 用户。所以我试试 phpseclib。不幸的是,该脚本不会返回任何用户创建的结果。然后我尝试做一个简单的命令 ls -la。仍然没有结果,只是加载了几秒钟并返回一个空白
我正在使用 Phpseclib 1.0 在远程服务器上执行多个命令。我知道如何将它配置为在出错时退出,但是有什么方法可以设置它在出错时停止并执行不同的命令吗?例如,我有 8 个命令要执行,当它全部工作
下载部分文件的最佳方法是什么(使用 phpseclib)。我有一个日志文件,其中不断附加数据。我想定期连接到远程服务器并下载最新的 block ,而不是每次都下载整个文件。 Rsync 是完美的,但并
我正在尝试使用它,但它只是给我这个错误,我不知道如何解决这个问题.. Warning: include_once(Math/BigInteger.php): failed to open stream
在我的一个项目中,我将使用 PHP 通过 SSH 远程连接许多服务器。有两种解决方案,phpseclib和 ssh2基于 libssh2 库的 PHP PECL 扩展。 那么谁能比较一下两者并谈谈它们
我在/home/pi/mydir 中有我想执行的脚本,所以我需要做的第一件事是 $ssh->exec('cd mydir'); 然后 $ssh->exec('./script'); 但它不起作用,所以
我已经在我的机器上安装了 Apache,因此我可以使用 localhost 作为 PHP 服务器。这样可行。现在我正在尝试使用 PHP 通过 SFTP 将文件发送到另一台服务器。我环顾四周,看到推荐使
我一直在寻找如何使用 php 的解决方案建立与远程服务器的连接并执行命令。研究使我注意到了两种解决方案; phpseclib和 ssh2 .我会尽量不让我的问题变成比较帖子。据我所知,它们都是广泛使用
我使用phpseclib建立SSH连接并执行代码。但是它有一个问题。 13秒超时。无论如何,我可以禁用此超时或将其延长吗?我需要在服务器上下载文件,该文件可能很大,因此需要13秒钟以上 最佳答案 尝试
当前正在尝试创建一个PHP Web应用程序以运行各种Shell脚本来处理网站生成和删除操作。 这是我的 deletePropertyProcess.php 的摘录: $ssh = new Net_SS
我正在尝试针对 HP C7000 Onboard Administrator 执行以下代码 include('Net/SSH2.php'); $ssh = new Net_SSH2('OA'); if
PhpSecLib 创建的默认证书文件将 keyUsage 设置为:All rules of applications。我如何将 keyUsage 设置为 Windows Crypto Shell 将
我正在尝试从 SFTP 服务器下载文件。我已经设法连接到它并下载了文件。问题是服务器中的文件会每天更新,并且文件名的一部分是它生成的确切时间,这是不可预测的。 我如何实现我的 PHP 脚本,以便它下载
我已经从 github 安装了 phpseclib 库,我正在尝试使用 PHP 加密密码(用于 Steam 社区)。我可以通过使用 Steam 在他们网站上的 javascript 代码来使用 Jav
我正在尝试在 Vagrant VM 中运行一个 PHP 文件,该 VM 也使用 Composer 进行构建。 我收到以下错误: PHP Warning: require(/var/www/CLIEN
我刚刚自己发现了 phpseclib,并想将它用于我的代码中。不知何故,我不知道如何将文件从一个 sftp 目录复制到另一个 sftp 目录。如果您能帮我解决这个问题,那就太好了。 例如: 复制所有文
我不明白这个错误: Your requirements could not be resolved to an installable set of packages. Problem 1 - don
我正在使用 phpseclib 库中的以下代码登录远程服务器(远程服务器使用:SFTP - SSH 文件传输协议(protocol)): login('username', 'password'))
我正在尝试使用 PHPSecLib 通过 PHP 中的 SFTP 连接到 SSH2 服务器。但我的问题是,服务器需要一个受密码保护的 key 文件,还需要用户名和密码。似乎只能提供用户名+密码或用户名
我是一名优秀的程序员,十分优秀!