Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Net::OpenSSH problem "controlpath is too long"

by Sombrerero_loco (Beadle)
on Mar 03, 2017 at 07:22 UTC ( [id://1183519]=perlquestion: print w/replies, xml ) Need Help??

Sombrerero_loco has asked for the wisdom of the Perl Monks concerning the following question:

Hi Guys. Again with problem with Net::OpenSSH and a script. Finally i managed to install Net:OpenSSH 0.74 on a HP-UX B11.31 This server is running this version of ssh
bash-4.3$ ssh -V OpenSSH_5.8p1+sftpfilecontrol-v1.3-hpn13v7, OpenSSL 0.9.8r 8 Feb 2011 HP-UX Secure Shell-A.05.80.004, HP-UX Secure Shell version
When i try to run the connect constructor, it returns me this error and stops (because of the Die and my script)
ControlPath too long SSH connetion failed: unable to establish master SSH connection: bad p +assword or master process exited unexpectedly at
Part of the script that fails
for my $vh(sort @hosts) { for my $vl(@logins) { for my $vp(@pwd) { print "Escaneando host $vh con usuarios $vl password $vp\n"; #PREPARAMOS CONEXION SSH my $ssh = Net::OpenSSH->new($vh, user => $vl, password => $vp) o +r warn "Host $vh caido\n"; $ssh->error and die "SSH connetion failed: " . $ssh->error; #print "$ssh->error"; ....
Any ideas?¿?¿

Replies are listed 'Best First'.
Re: Net::OpenSSH problem "controlpath is too long"
by salva (Canon) on Mar 03, 2017 at 09:09 UTC
    Net::OpenSSH communicates with the OpenSSH master process through a socket that by default has a name similar to /home/user/.libnet-openssh-perl/my.host.name.com-4589-445. The maximum length for the path is given by the size of the sun_path slot on the sockaddr_un structure, which seems to be 92 bytes for HP-UX.

    So, your home has a very long path or you are accessing hosts with extremely long file names or both. As a workaround, you can set a shorter path passing it into the constructor with the option ctl_path.

    In any case, the module shouldn't fail just because the hostname is too long. This is a bug I will fix in the next release.

    Update: version 0.75_01 is now available!

Re: Net::OpenSSH problem "controlpath is too long"
by thanos1983 (Parson) on Mar 03, 2017 at 09:11 UTC

    Hello again Sombrerero_loco

    I noticed on the sample of your script that you are SSH to multiple nodes:

    for my $vh(sort @hosts) {

    This kind of processes will force sequential SSH sessions. I can not really test your code since you have provide us only a sample, so I can not replicate your problem.

    Update: of course the author knows how to resolve the problem. Just take a look also on similar examples in case you find something useful.

    But, in the past I had similar problems I tested any possible way of ssh, telnet modules that I could find. Take a look with working codes examples Best module to execute administrator commands on external operating systems (Linux).

    Recently also another monk was asking for something similar (been able to SSH to multiple nodes). I created a working example for him with Net::OpenSSH::Parallel and the example is multiple machines disk space alert.

    Similarly if you want to execute also SUDO commands, including example with working code Net::OpenSSH::Parallel with sudo commands.

    Hope this helps, maybe to have another approach to your problem.

    Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1183519]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-24 10:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found