gpt4 book ai didi

perl - Net::OpenSSH::Gateway->find_gateway 在设置 ControlPersist 选项时失败

转载 作者:行者123 更新时间:2023-12-02 14:22:35 24 4
gpt4 key购买 nike

我正在尝试使用 Net::OpenSSH::Gateway 创建持久网关连接。下面是我使用的代码片段。

my %proxy_opts = (
host => $host,
port=>$port,
password=>$password,
user=>$user ,
scheme=>"ssh",
ssh_cmd => '/usr/bin/ssh',
master_opts =>
[ -o=>"StrictHostKeyChecking=no",
-o=>"TCPKeepAlive=no",
-o=>"ServerAliveInterval=30",
-o=>"ServerAliveCountMax=90",
-o=>"ControlPath=/tmp/ssh-master-%h_%p_%r",
-o=>"ControlPersist=yes"
]
);

my %gateway_settings = ( proxies=>[ {%proxy_opts} ]);
my $gateway = Net::OpenSSH::Gateway->find_gateway(%gateway_settings, errors=>$errors);

我收到以下错误。但是,如果我删除选项 ControlPath 和 ControlPersist ,整个事情就可以正常工作。

[ERROR ] unable to establish master SSH connection: bad ssh master at /root/.libnet-openssh-perl/spangeni-j1.zscaler.-31930-744378, socket owned by pid 31933 (pid 31931 expected)

最佳答案

我认为这是模块中的错误。模块Net::OpenSSH::Gateway CPAN 上不存在,作者已经说过:

I have not published it on CPAN yet because, even it is already functional, I have found some problems with its internal architecture that I want to solve first. -Source



此外,如果您看到 Net::OpenSSH 的文档您会看到网关是一项实验性功能。

enter image description here

顺便说一句 OpenSSH 是什么版本你正在用吗? ControlPersist 需要 OpenSSH 5.6 或更新。

关于perl - Net::OpenSSH::Gateway->find_gateway 在设置 ControlPersist 选项时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24445573/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com