"remote server doesn't accept running more than one channel concurrently per SSH connection"
Yes, i think about it. But don`t know how to check this. May be this check can be realize in Net::OpenSSH?
Result:
# open_ex: ['ssh','-V']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 46 at offset 0
#> 4f 70 65 6e 53 53 48 5f 35 2e 33 70 31 2c 20 4f 70 65 6e 53 53 4c 20 31 2e 30 2e 30 2d 66 69 70 | OpenSSH_5.3p1, OpenSSL 1.0.0-fip
#> 73 20 32 39 20 4d 61 72 20 32 30 31 30 0a | s 29 Mar 2010.
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 0 at offset 46
# leaving _io3()
# _waitpid(3317) => pid: 3317, rc: 0, err:
# OpenSSH verion is 5.3p1,
# ctl_path: /home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411, ctl_dir: /home/dslam/.libnet-openssh-perl/
# _is_secure_path(dir: /home/dslam/.libnet-openssh-perl, file mode: 16877, file uid: 1056, euid: 1056
# _is_secure_path(dir: /home/dslam, file mode: 16877, file uid: 1056, euid: 1056
# set_error(0 - 0)
# call args: ['ssh','-vvvv','-o','ServerAliveInterval=20','-2MNx','-S','/home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411','213.228.116.181','--']
# master state jumping from _STATE_START to _STATE_AWAITING_MUX
# file object not yet found at /home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411, state:_STATE_AWAITING_MUX
# file object not yet found at /home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411, state:_STATE_AWAITING_MUX
# file object not yet found at /home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411, state:_STATE_AWAITING_MUX
# file object not yet found at /home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411, state:_STATE_AWAITING_MUX
# file object not yet found at /home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411, state:_STATE_AWAITING_MUX
# file object not yet found at /home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411, state:_STATE_AWAITING_MUX
# tracer attached, ssh pid: 3318, tracer pid: 3319
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 213.228.116.181 [213.228.116.181] port 22.
debug1: Connection established.
debug1: identity file /home/dslam/.ssh/id_rsa type -1
debug1: identity file /home/dslam/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version 2.0.12
debug1: match: 2.0.12 pat 2.0.11*,2.0.12*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug3: Wrote 792 bytes for a total of 813
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-dss
debug2: kex_parse_kexinit: 3des-cbc,blowfish-cbc
debug2: kex_parse_kexinit: 3des-cbc,blowfish-cbc
debug2: kex_parse_kexinit: hmac-sha1,hmac-md5
debug2: kex_parse_kexinit: hmac-sha1,hmac-md5
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5
debug1: kex: server->client 3des-cbc hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server 3des-cbc hmac-md5 none
debug2: dh_gen_key: priv key bits set: 193/384
debug2: bits set: 530/1024
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug3: Wrote 144 bytes for a total of 957
debug3: check_host_in_hostfile: filename /home/dslam/.ssh/known_hosts2
debug3: check_host_in_hostfile: match line 1
debug1: Host '213.228.116.181' is known and matches the DSA host key.
debug1: Found key in /home/dslam/.ssh/known_hosts2:1
debug2: bits set: 530/1024
debug1: ssh_dss_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: Wrote 16 bytes for a total of 973
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug3: Wrote 48 bytes for a total of 1021
debug2: buggy server: service_accept w/o service
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/dslam/.ssh/id_rsa ((nil))
debug2: key: /home/dslam/.ssh/id_dsa ((nil))
debug3: Wrote 64 bytes for a total of 1085
debug1: Authentication succeeded (none).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: setting up multiplex master socket
debug2: fd 7 setting O_NONBLOCK
debug1: Entering interactive session.
debug3: Wrote 56 bytes for a total of 1141
# file object found at /home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411
# master state jumping from _STATE_AWAITING_MUX to _STATE_RUNNING
# call args: ['ssh','-O','check','-T','-S','/home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411','213.228.116.181','--']
# open_ex: ['ssh','-O','check','-T','-S','/home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411','213.228.116.181','--']
# io3 mloop, cin: 0, cout: 1, cerr: 0
# io3 fast, cin: 0, cout: 1, cerr: 0
debug3: fd 8 is not O_NONBLOCK
debug3: ssh_msg_recv entering
debug3: ssh_msg_send: type 2
# stdout, bytes read: 27 at offset 0
#> 4d 61 73 74 65 72 20 72 75 6e 6e 69 6e 67 20 28 70 69 64 3d 33 33 31 38 29 0d 0a | Master running (pid=3318)..
# io3 fast, cin: 0, cout: 1, cerr: 0
# stdout, bytes read: 0 at offset 27
# leaving _io3()
# _waitpid(3322) => pid: 3322, rc: 0, err:
hello! at testssh.pl line 43.
debug2: channel 0: open confirm rwindow 12288 rmax 512
bye! at testssh.pl line 45.
# call args: ['ssh','-S','/home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411','213.228.116.181','--','exit']
# open_ex: ['ssh','-S','/home/dslam/.libnet-openssh-perl/213.228.116.181-3316-998411','213.228.116.181','--','exit']
debug3: fd 8 is not O_NONBLOCK
debug3: ssh_msg_recv entering
debug3: ssh_msg_send: type 2
debug3: ssh_msg_recv entering
debug3: muxserver_accept_control: receiving 1 env vars
debug2: muxserver_accept_control: accepted tty 0, subsys 0, cmd exit
debug2: muxserver_accept_control: got fds stdin 9, stdout 10, stderr 11
debug3: ssh_msg_send: type 2
debug2: fd 8 setting O_NONBLOCK
debug1: channel 1: new [client-session]
debug3: muxserver_accept_control: channel_new: 1
debug2: channel 1: send open
debug3: Wrote 56 bytes for a total of 1197
Received disconnect from 213.228.116.181: 2:
# _waitpid(3325) => pid: 3325, rc: 65280, err: Прерван системный вызов
# set_error(5 - child exited with code 255)
# DESTROY(Net::OpenSSH=HASH(0x2b583d8), pid: 3318)
# sending exit control to master
# master 3318 exited, rc:65280, err:
# set_error(1 - control command failed: master process exited unexpectedly)
# master state jumping from _STATE_RUNNING to _STATE_GONE
# master state jumping from _STATE_GONE to _STATE_GONE
Show quoted text>Четверг, 17 сентября 2015, 6:27 -04:00 от "Salvador \"Fandiño\" via RT" <bug-Net-OpenSSH@rt.cpan.org>:
>
><URL:
https://rt.cpan.org/Ticket/Display.html?id=107099 >
>
>
>
>
>
>----- Original Message -----
>> From: Алексей Павлов via RT < bug-Net-OpenSSH@rt.cpan.org >
>> To:
>> Cc:
>> Sent: Thursday, September 17, 2015 11:24 AM
>> Subject: Re[12]: [rt.cpan.org #107099] Connect with -N key
>>
>> Queue: Net-OpenSSH
>> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=107099 >
>>
>> Yes, this command work. From previous my answer:
>
>> debug1: Remote protocol version 2.0, remote software version 2.0.12
>
>Yes, but OpenSSH has several workarounds inside for servers that do not implement the protocol correctly and forcing v2 could be disabling some.
>
>Anyway, after looking at all the traces you have posted I am pretty sure the real problem is that the remote server doesn't accept running more than one channel concurrently per SSH connection.
>
>Just to ensure that this is the case, could you run the following script:
>
> use Net::OpenSSH;
> $Net::OpenSSH::debug=-1;
> $ssh = Net::OpenSSH->new(localhost, master_opts => [qw(-vvv)]);
> warn "hello!";
> sleep 4;
> warn "bye!";
> $ssh->system("exit")
>
>If that hypothesis turns to be true, then Net::OpenSSH can't not be made to work because it requires multiple channels.
>
>Maybe you could use my other module Net::SSH::Any (go for the development version in GitHub
>
https://github.com/salva/p5-Net-SSH-Any ) whose usage is pretty similar to that of Net::OpenSSH, or Net::SSH2 (ensure you get the latest development version 0.54_02).
>
>Also, there are several modules on CPAN specific for talking to network equipment.
>
С уважением, Павлов Алексей :-)