标签: libssh2

phpseclib或ssh2 pecl扩展名

我昨天的帖子:https://stackoverflow.com/questions/14296006/phpseclib-sftp-port-number

好的,昨天我开始用php学习SSH/SFTP.我搜索了一堆论坛帖子,并推测我需要下载phpseclib.

相对较新的php因此从php5开始我不知道以前的php4不使用__constructor,因此上面的问题/帖子.

回答是相互矛盾的,然而对于原始问题而言有点偏离主题却让我想到了一个我觉得在继续之前需要回答的问题:

哪个更好用,ssh2 pecl扩展 OR phpseclib

这个问题:phpseclib vs libssh2是一样的,但我觉得现在有点过时,正如2010年11月5日17:37所问的那样

php libssh2 phpseclib

3
推荐指数
1
解决办法
9936
查看次数

通过SSH获取CPU使用率

我想通过SSH检索CPU利用率百分比,我尝试了命令"top",但它不会让我.

我正在使用CentOS 6.

我试过这段代码

$connection = ssh2_connect("IP", PORT);
ssh2_auth_password($connection, "root", "PASS");
$stream = ssh2_exec($connection, "top");
$errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);

// Enable blocking for both streams
stream_set_blocking($errorStream, true);
stream_set_blocking($stream, true);

// Whichever of the two below commands is listed first will receive its appropriate output.  The second command receives nothing
echo "Output: " . stream_get_contents($stream);
echo "Error: " . stream_get_contents($errorStream);

// Close the streams        
fclose($errorStream);
fclose($stream);
Run Code Online (Sandbox Code Playgroud)

但它每次都给我一个错误:输出:错误:未设置TERM环境变量.

我正在使用PHP.

php linux libssh2 centos6

3
推荐指数
1
解决办法
1万
查看次数

在windows上编译libssh2

有人可以帮我用Visual Studio 2017在windows上编译libssh2.我发现的唯一的东西太旧了,过时了.

我从github下载了libssh2并运行cmake libssh2然后cmake -P cmake_install.cmake找不到INSTALL文件"libssh2.lib".

我被困在这里!

********更新1***********

缺少Crypto_backend,我尝试使用openssl进行编译并获得大量未解析的符号.

********更新2***********

好!我使用了cmake-gui并摆脱了未解决的符号,但现在我遇到了一些头文件的问题.libssh2 var类型未定义.某种包括失踪......?

c++ ssh cmake libssh2

3
推荐指数
1
解决办法
6130
查看次数

获取指向类方法的指针,以便可以将其作为回调传递给C函数

我正在使用libssh2并在我的SSHWrapper对象之外定义了一个回调函数:

static void kbd_callback(const char *name, int name_len, const char *instruction, int instruction_len, int num_prompts, const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts, LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses, void **abstract);
Run Code Online (Sandbox Code Playgroud)

在我的SSHWrapper对象中,我执行以下操作,在验证会话时传递回调函数:

/* Create a session instance */
LIBSSH2_SESSION *session = libssh2_session_init_ex(NULL, NULL, NULL, self);
while ((rc = libssh2_userauth_keyboard_interactive(session, userChar, &kbd_callback)) == LIBSSH2_ERROR_EAGAIN);
Run Code Online (Sandbox Code Playgroud)

我想知道的是,是否可以kbd_callback()在我的对象中移动函数,以便它是一个类方法:+(void) kbd_callback:...

如果是这样,我如何获取该函数的地址以将其传递给C函数libssh2_userauth_keyboard_interactive()

c function-pointers objective-c libssh2

2
推荐指数
1
解决办法
1298
查看次数

SSH2无法在新服务器上运行

我们已经更改了托管公司,ssh2工作的地方已经不再适用了.我们已ssh2启用新服务器并已allow_url_fopen启用.

我能看到的唯一区别是使用的旧服务器PHP 5.4.45和新服务器正在使用PHP 5.6.28.

但是,我现在得到以下错误. Could not open remote file: ssh2.sftp://Resource id #337/my/directory/file.txt

这是我的代码示例:

$remote_host = "myhostinfohere";
$remote_port = 22;
$remote_user = "myuser";
$remote_pass = "mypassword";
$remote_dir = "/my/directory/";
$remote_file = 'file.txt';

try {
    $remote_conn = ssh2_connect($remote_host, $remote_port);    
} catch (Exception $e) {
    die("could not connect to ".$remote_host);
}

try {
    ssh2_auth_password($remote_conn, $remote_user, $remote_pass);
} catch (Exception $e) {
    die("Password failed on ".$remote_host);
}

$sftp = ssh2_sftp($remote_conn);

$fetch_string = "ssh2.sftp://$sftp" . $remote_dir …
Run Code Online (Sandbox Code Playgroud)

php libssh2 ssh2-sftp

2
推荐指数
1
解决办法
2959
查看次数

XCode构建失败 - 缺少aclocal [/ share]文件

我正在尝试构建一个XCode项目,并在尝试构建时遇到以下错误:

...
Building for x86_64 i386 armv7 armv7s arm64
Building libssh2 for iphonesimulator7.1 x86_64
Please stand by...
/Users/jordanforeman/dev/ios/MyProject/objective-git/External/libssh2-ios/bin/iphonesimulator7.1-x86_64.sdk/build-libssh2.log
Command /bin/sh failed with exit code 1

** BUILD FAILED **


The following build commands failed:
    PhaseScriptExecution Run\ Script /Users/jordanforeman/Library/Developer/Xcode/DerivedData/MyProject-azifgvrunekkgmagzghrrvpdathe/Build/Intermediates/ObjectiveGitFramework.build/Debug-iphoneos/libssh2-iOS.build/Script-6A3C609117D5963700382DFF.sh
(1 failure)
Run Code Online (Sandbox Code Playgroud)

看一看,build-libssh2.log我看到以下内容:

aclocal: error: aclocal: file '/usr/local/share/aclocal/pkg.m4' does not exist
autoheader: error: AC_CONFIG_HEADERS not found in configure.ac
cp: src/libssh2_config.h.in: No such file or directory
configure.ac:5: error: possibly undefined macro: AM_CONFIG_HEADER
      If this token and others are legitimate, please use …
Run Code Online (Sandbox Code Playgroud)

xcode automake libssh2 objective-git

1
推荐指数
1
解决办法
1507
查看次数

在 Windows 上使用 libssh2 和 libopenssl 的 libgit2

我以前尝试过,但在完整版本中几乎没有成功,但即使现在失败了,而且我显然在 Windows 上遗漏了一些东西(是的,它可能是 Windows :P)

有人可以带我过去吗

  1. 找到正确的 OpenSSL 以使用 libssh2 进行编译
  2. 实际上cmake/将libssh2编译成libgit2,因为它一直说找不到libssh2,我正在努力再次构建它。

我正在使用 CMake gui For windows,尝试构建一个 VC2015 项目

我在构建 libgit2 时遇到的错误是

checking for module 'libssh2'
  package 'libssh2' not found

LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.
Run Code Online (Sandbox Code Playgroud)

即使我已经把它放在每一个可能的地方,我认为它会看起来,我试过设置CMAKE_PREFIX_PATH

如果有人在 Windows 上成功完成了它,我将不胜感激一两个关于我做错了什么或应该做什么的指针

谢谢罗伯特

c++ openssl libgit2 libssh2 visual-c++-2015

0
推荐指数
1
解决办法
2265
查看次数

安装具有自制软件和 php 7.3 的 ssh2 扩展

我在尝试ssh2使用 pecl安装扩展时遇到以下错误:

17 warnings and 3 errors generated.
make: *** [ssh2_fopen_wrappers.lo] Error 1
ERROR: `make' failed
Run Code Online (Sandbox Code Playgroud)

这是我所做的:

brew install php
brew install libssh2
pecl install ssh2-1.1.2
Run Code Online (Sandbox Code Playgroud)

那安装了 php 7.3.3,libssh2 1.8.0 并且无法安装 ssh2-1.1.2。
有没有人有解决问题的方法?谢谢!

相关链接:
https : //github.com/docker-library/php/issues/767
为 PHP 安装 PECL SSH2 扩展

homebrew pecl libssh2 ssh2 php-7.3

0
推荐指数
1
解决办法
2768
查看次数