|Don't ask to ask, just ask|
Re^3: SSH to remote subsystem (Net::OpenSSH?)by salva (Abbot)
|on Mar 20, 2013 at 08:53 UTC||Need Help??|
Using your suggestion, I tried...
You have two calls to open2socket, the first establishes a connection to the Netconf subsystem, but then on the next line it opens a new one to a shell overwriting $socket.
The correct way to do it is as follows:
Expecting to either see the XML hello message in the debug, or in the socket print. However, it appears that it first makes a connection to the main system, authenticates, and then tries to connect to the subsystem. I'm not good enough with SSH to know if that's how it works with except/shell version or not.
This is how the SSH protocol works, first a TCP connection is established, then encryption and authentication are negotiated and from that point, bidirectional channels can be open freely between the client and server even in parallel (though, most servers set a limit on the number of concurrent channels, typically 10).
When you run ssh from the command line or using Expect, the two phases are performed under the hood by the ssh client, though just one channel is open.
The "-s" flag is at the beginning, but the "xmlagent" value is at the end
Yes, it works that way, the subsystem name is not an argument to the -s flag but it is taken from the remote command at the end of the ssh argument list (see ssh).
BTW, the specification for NETCONF over SSH (rfc4742) says the server must listen not at the default SSH port (22) but at port 830. Have you activated the subsystem also at port 22?