【问题标题】:error in openSSH on windowsWindows 上的 openSSH 错误
【发布时间】:2014-05-30 20:09:44
【问题描述】:
use strict;
use warnings;
use Net::OpenSSH;

$Net::OpenSSH::debug |= 16;

my $ssh = Net::OpenSSH->new(host=>'xx.xx.xx.xx',
                            user => 'xxxx',
                            password => 'xxxx'
);

$ssh->error and die "SSH connection failed: " . $ssh->error;
my $command = "ls";
my @out = $ssh->capture($command);
print @out;

上面的程序给出了以下错误

SSH connection failed: unable to determine home directory for uid 0 at ./ssh.pl
line 12.

我正在使用 avtivestate perl (v5.12.3)

虽然我给了另一个用户而不是 root,但它给出了同样的错误。
我在主机上有 centos 6.4。
谁能帮帮我?

【问题讨论】:

  • 不清楚您在本地使用什么操作系统(您的 Perl 在哪里运行)。是 CentOS 还是 CentOS 在您尝试通过 ssh 访问的远程主机上运行?
  • @Ouki 我有 Windows 作为我的客户端,我在远程主机上使用 Hv centos。我正在尝试通过 ssh 访问。
  • 然后米勒得到了正确的答案。
  • Net::OpenSSH 在 Windows 上不起作用。您最好的选择可能是 Net::SSH2Net::SSH::Any(在 Net::SSH2 之上)。

标签: perl openssh


【解决方案1】:

来自Net::OpenSSH 的文档:

另一方面,Net::OpenSSH 在 Windows 上不工作,甚至在 Cygwin 下也不工作。

对于替代解决方案:How do we configure SSH using Perl in Windows?

【讨论】:

    猜你喜欢
    • 2018-09-30
    • 2017-01-16
    • 2020-04-22
    • 1970-01-01
    • 2018-07-30
    • 2020-03-10
    • 2017-02-07
    • 2018-06-05
    • 2017-01-12
    相关资源
    最近更新 更多