Re: Net::SSH::Perl bind socket problem

2005-06-13 Thread gui
Thanks for your explanations MNibble, I'm still not sure what to do with
 fork, but now I have an idea of how it works.

I finally got that problem solved!!!

when executing the script as root the priviliged parameters is set to 1
by default. priviliged binds you to a specific port. In order to change
that, it as to be set to 0 manually when parameting Net::SSH::Perl

my %params = (
'priviledge'=0,
'protocol' = 2,
'identity_files' = [EMAIL PROTECTED],
);

MNibble a écrit :
 Gui wrote:
 
 I'm really sorry for not replying during all this time. I'm involved in
 lots of project, and I had to set this one aside for a moment. But now
 I'm determined to get this thing fix!

 I still have beginner level in perl, and can't quite make sense of the
 code you posted.

 I asked the net::ssh::perl mailing list about the pb, but the only
 response I got back from that time was use fork. unfortunatly, I don't
 quite get how I should use fork (if someone knows a URL where there is
 good tutorial or post or something where I can learn fork, please reply
 and add that link!). Anyway, I'll send another email to the list...
 maybe I'll get different responses.

 I'm surprised nobody got interested in this problem. Anybody had a
 socket bind problem before?

 John Doe a écrit :

 Am Mittwoch, 6. April 2005 12.52 schrieb gui:

 This phenomen with the TIME_WAIT was my other thought to explain the
 behavior of your script, but then I decided not to mention it because
 I thought that the sub _create_socket code in Perl.pm will handle this:

 * code *
 sub _create_socket {
my $ssh = shift;
my $sock = gensym;

 my ($p,$end,$delta) = (0,1,1); # normally we use whatever port we can
 get
   ($p,$end,$delta) = (1023,512,-1) if
 $ssh-{config}-get('privileged');

 # allow an explicit bind address
my $addr = $ssh-{config}-get('bind_address');
 $addr = inet_aton($addr) if $addr;
 ($p,$end,$delta) = (1,65535,1) if $addr and not $p;
 $addr ||= INADDR_ANY;

for(; $p != $end; $p += $delta) {
socket($sock, AF_INET, SOCK_STREAM, getprotobyname('tcp') ||
 0) ||
croak Net::SSH: Can't create socket: $!;
last if not $p or bind($sock, sockaddr_in($p,$addr));
if ($! =~ /Address already in use/i) {
close($sock);
next;
}
croak Net::SSH: Can't bind socket to port $p: $!;
}
 if($p) {
  $ssh-debug(Allocated local port $p.);
  $ssh-{config}-set('localport', $p);
 }

$sock;
 }

 *--- code ---*

 The code tries to bind to several ports (1023 down to 512).

 But now, when I look again - but still not deeply enough!... (and use
 the hint the port 1023 was also tried in the _second_ loop run)...
 the code seems only to handle the port already in use case...

 Please look at the above code deeper... the croak code could be the
 problem, and a possibility could be not to croak so fast, but try
 port after port until binding has been done or the port range has
 fully be tested.

 I could have a deeper look myself tomorrow ...äh... après-midi, if
 you wish (we're located in the same time zone I think).

 btw - where are all the cracks who have the
 instant-shortestpossible-100%solution for all ???

 greetings joe
 
 
 
 fork is only a nice way of making 2 process out off one
 
 die $! unless defined (my $child = fork());
 if ($child == 0)
 {
 #Everything here is unrelateted to the OTHER
 print $$;
 
 }
 else
 {
 #OTHER
 print $$;
 }
 unrelated is .. a bit wrong, since you just created a child process, in
 that childprocess you get the filehandles from the org. process.
 Variable you have create before the fork are if needed also forked
 (duplicated). After the fork you have 2 processes. The parent process
 can ident his child. The var. my $child is for the parent 0 and for the
 child the pid of that child.
 
 
 
 
 
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Net::SSH::Perl bind socket problem

2005-06-11 Thread MNibble

Gui wrote:

I'm really sorry for not replying during all this time. I'm involved in
lots of project, and I had to set this one aside for a moment. But now
I'm determined to get this thing fix!

I still have beginner level in perl, and can't quite make sense of the
code you posted.

I asked the net::ssh::perl mailing list about the pb, but the only
response I got back from that time was use fork. unfortunatly, I don't
quite get how I should use fork (if someone knows a URL where there is
good tutorial or post or something where I can learn fork, please reply
and add that link!). Anyway, I'll send another email to the list...
maybe I'll get different responses.

I'm surprised nobody got interested in this problem. Anybody had a
socket bind problem before?

John Doe a écrit :


Am Mittwoch, 6. April 2005 12.52 schrieb gui:

This phenomen with the TIME_WAIT was my other thought to explain the behavior 
of your script, but then I decided not to mention it because I thought that 
the sub _create_socket code in Perl.pm will handle this:


* code *
sub _create_socket {
   my $ssh = shift;
   my $sock = gensym;

my ($p,$end,$delta) = (0,1,1); # normally we use whatever port we can get
  ($p,$end,$delta) = (1023,512,-1) if $ssh-{config}-get('privileged');

# allow an explicit bind address
   my $addr = $ssh-{config}-get('bind_address');
$addr = inet_aton($addr) if $addr;
($p,$end,$delta) = (1,65535,1) if $addr and not $p;
$addr ||= INADDR_ANY;

   for(; $p != $end; $p += $delta) {
   socket($sock, AF_INET, SOCK_STREAM, getprotobyname('tcp') || 0) ||
   croak Net::SSH: Can't create socket: $!;
   last if not $p or bind($sock, sockaddr_in($p,$addr));
   if ($! =~ /Address already in use/i) {
   close($sock);
   next;
   }
   croak Net::SSH: Can't bind socket to port $p: $!;
   }
if($p) {
 $ssh-debug(Allocated local port $p.);
 $ssh-{config}-set('localport', $p);
}

   $sock;
}

*--- code ---*

The code tries to bind to several ports (1023 down to 512).

But now, when I look again - but still not deeply enough!... (and use the hint 
the port 1023 was also tried in the _second_ loop run)... the code seems 
only to handle the port already in use case...


Please look at the above code deeper... the croak code could be the problem, 
and a possibility could be not to croak so fast, but try port after port 
until binding has been done or the port range has fully be tested.


I could have a deeper look myself tomorrow ...äh... après-midi, if you wish 
(we're located in the same time zone I think).


btw - where are all the cracks who have the 
instant-shortestpossible-100%solution for all ???


greetings joe



fork is only a nice way of making 2 
process out off one


die $! unless defined (my $child = fork());
if ($child == 0)
{
	#Everything here is unrelateted to 
the OTHER

print $$;

}
else
{
#OTHER
print $$;
}
unrelated is .. a bit wrong, since you 
just created a child process, in that 
childprocess you get the filehandles 
from the org. process. Variable you have 
create before the fork are if needed 
also forked (duplicated). After the fork 
you have 2 processes. The parent process 
can ident his child. The var. my $child 
is for the parent 0 and for the child 
the pid of that child.








--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Net::SSH::Perl bind socket problem

2005-06-10 Thread gui
I'm really sorry for not replying during all this time. I'm involved in
lots of project, and I had to set this one aside for a moment. But now
I'm determined to get this thing fix!

I still have beginner level in perl, and can't quite make sense of the
code you posted.

I asked the net::ssh::perl mailing list about the pb, but the only
response I got back from that time was use fork. unfortunatly, I don't
quite get how I should use fork (if someone knows a URL where there is
good tutorial or post or something where I can learn fork, please reply
and add that link!). Anyway, I'll send another email to the list...
maybe I'll get different responses.

I'm surprised nobody got interested in this problem. Anybody had a
socket bind problem before?

John Doe a écrit :
 Am Mittwoch, 6. April 2005 12.52 schrieb gui:
 
 This phenomen with the TIME_WAIT was my other thought to explain the behavior 
 of your script, but then I decided not to mention it because I thought that 
 the sub _create_socket code in Perl.pm will handle this:
 
 * code *
 sub _create_socket {
 my $ssh = shift;
 my $sock = gensym;
 
  my ($p,$end,$delta) = (0,1,1); # normally we use whatever port we can get
($p,$end,$delta) = (1023,512,-1) if $ssh-{config}-get('privileged');
 
  # allow an explicit bind address
 my $addr = $ssh-{config}-get('bind_address');
  $addr = inet_aton($addr) if $addr;
  ($p,$end,$delta) = (1,65535,1) if $addr and not $p;
  $addr ||= INADDR_ANY;
 
 for(; $p != $end; $p += $delta) {
 socket($sock, AF_INET, SOCK_STREAM, getprotobyname('tcp') || 0) ||
 croak Net::SSH: Can't create socket: $!;
 last if not $p or bind($sock, sockaddr_in($p,$addr));
 if ($! =~ /Address already in use/i) {
 close($sock);
 next;
 }
 croak Net::SSH: Can't bind socket to port $p: $!;
 }
  if($p) {
   $ssh-debug(Allocated local port $p.);
   $ssh-{config}-set('localport', $p);
  }
 
 $sock;
 }
 
 *--- code ---*
 
 The code tries to bind to several ports (1023 down to 512).
 
 But now, when I look again - but still not deeply enough!... (and use the 
 hint 
 the port 1023 was also tried in the _second_ loop run)... the code seems 
 only to handle the port already in use case...
 
 Please look at the above code deeper... the croak code could be the problem, 
 and a possibility could be not to croak so fast, but try port after port 
 until binding has been done or the port range has fully be tested.
 
 I could have a deeper look myself tomorrow ...äh... après-midi, if you wish 
 (we're located in the same time zone I think).
 
 btw - where are all the cracks who have the 
 instant-shortestpossible-100%solution for all ???
 
 greetings joe

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Net::SSH::Perl bind socket problem

2005-04-08 Thread gui
John Doe wrote:
Am Dienstag, 5. April 2005 15.20 schrieb gui:
[snip]
Net::SSH: Can't bind socket to port 1023: Adresse déjà utilisée at
./test_ssh.pl line 50

There's also a mailing list dedicated to Net::SSH::Perl (from man page):
SUPPORT
   For samples/tutorials, take a look at the scripts in eg/ in the 
distribution directory.

   There is a mailing list for development discussion and usage questions.  
Posting is limited to subscribers only.  You can sign up at 
http://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users

   Please report all bugs via rt.cpan.org at 
https://rt.cpan.org/NoAuth/ReportBug.html?Queue=net%3A%3Assh%3A%3Aperl

joe
I totally forgot about that, thanks!
I just subscribe, and send an email... I'll post the responses
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Net::SSH::Perl bind socket problem

2005-04-07 Thread John Doe
Am Dienstag, 5. April 2005 15.20 schrieb gui:
[snip]
 Net::SSH: Can't bind socket to port 1023: Adresse déjà utilisée at
 ./test_ssh.pl line 50

There's also a mailing list dedicated to Net::SSH::Perl (from man page):

SUPPORT
   For samples/tutorials, take a look at the scripts in eg/ in the 
distribution directory.

   There is a mailing list for development discussion and usage questions.  
Posting is limited to subscribers only.  You can sign up at 
http://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users

   Please report all bugs via rt.cpan.org at 
https://rt.cpan.org/NoAuth/ReportBug.html?Queue=net%3A%3Assh%3A%3Aperl

joe

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Net::SSH::Perl bind socket problem

2005-04-06 Thread John Doe
Bonjour

Not many answers, so...

Am Montag, 4. April 2005 21.16 schrieb gui:
 hello,

 I'm making a simple script that's supposed to update a certain number of
 boxes, spread around the area.
 my script is supposed to to connect to every hosts (via a file named
 hosts) using ssh, launch wget to retrieve the patch update, and
 install it.
 Things work fine for the first host of the list. But can never get
 beyong that. I get a Net::SSH: Can't bind socket to port 1023: Adresse
 déjà utilisée at ./test_ssh.pl line 46 message.

 my question is, how can I unbind the socket used by Net::SSH::Perl ?

 here's part of my code:

 use strict;
 use Net::SSH::Perl;

 my ($patchurl,$stout,$sterr,$exit,$ssh);
 my @ids = $ENV{HOME}/.ssh/id_rsa;

 my %params = (
  'protocol' = 2,
  'identity_files' = [EMAIL PROTECTED],
 );

 $patchurl = push @ARGV

 open HOSTS, hosts or die je n'ai pas réussi à ouvrir le fichier hosts

 : $!;

 while(HOSTS){

  (...)

   $ssh = Net::SSH::Perl-new($_, %params);
  $ssh-login(root);
  ($stout,$sterr,$exit) = $ssh-cmd(wget -q $patchurl);

  (...)
 }


 thanks

I don't see the exact reason. But after having a look in the code (Perl.pm, 
sub _create_socket, which tries ports from 1023 down to 512 to bind to), 
maybe the ssh object is not destroyed between the loops. You could try:

** define $ssh as my variable within the loop (not outside as currently)
** put the code within the loop in a separate block, containing the 
my-Definition of $ssh
** use undef $ssh at the end of the loop (still within it of course)
** Insert some diagnostic code at the beginning of the loop that 
a) examines the $ssh object before the second loop run and/or 
b) sleeps for e.g. a minute, so that you can look whats happening with the 
bound port (netstat -neat from cmdline)

I don't have the Modules installed, so I didn't made tests, sorry.

joe

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Net::SSH::Perl bind socket problem

2005-04-06 Thread gui
John Doe wrote:

I don't see the exact reason. But after having a look in the code (Perl.pm, 
sub _create_socket, which tries ports from 1023 down to 512 to bind to), 
maybe the ssh object is not destroyed between the loops. You could try:

** define $ssh as my variable within the loop (not outside as currently)
** put the code within the loop in a separate block, containing the 
my-Definition of $ssh
** use undef $ssh at the end of the loop (still within it of course)
** Insert some diagnostic code at the beginning of the loop that 
a) examines the $ssh object before the second loop run and/or 
b) sleeps for e.g. a minute, so that you can look whats happening with the 
bound port (netstat -neat from cmdline)

I don't have the Modules installed, so I didn't made tests, sorry.
joe
I tried some of your recommendations, like declaring $ssh in the loop 
and use undef $ssh at the end, but didn't solve the problem.
I did use netstat -neat during, and after the script launch. I didn't 
see anything weird during the script running, I did see something 
bizarre after :

tcp0  0 192.168.0.3:1023192.168.0.1:22 
TIME_WAIT  0  0

that line, stayed there for at least a full minute before disappearing. 
So I decided to add a 2min sleep at the end of the loop... and to my 
surprise : IT WORKED!
I used netstat during the 2min sleep, it seems that the connection to 
the 1023 socket lasts something between 1-2 minutes.

It's weird, I wish there were another way around it. If anybody got an 
explanation or a better solution about this socket bind for more than a 
minute, than just disappears enigma, I'd be glad.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Net::SSH::Perl bind socket problem

2005-04-06 Thread Michael Gale
Hello,

I am not a experienced perl programmer but from the look at your first
post with the perl code. Do you not have to run a close sessions ?

So after your commands:


$ssh = Net::SSH::Perl-new($_, %params);
 $ssh-login(root);
 ($stout,$sterr,$exit) = $ssh-cmd(wget -q $patchurl);

#then add in
close_session($ssh);

Also, if each connection is truly a new connection, should it not be
using a different source port ? If the source port is not changing then
it looks like your code is trying to use the same SSH connection
handle. 

I believe the RFC's make some reference to the tcp port being in a
TIME_WAIT state after a connection closes in case the remote machine
needs to finish up it's end and send a packet or two back.

Michael.


On Wed, 2005-04-06 at 12:52 +0200, gui wrote:
 John Doe wrote:
  
  
  I don't see the exact reason. But after having a look in the code (Perl.pm, 
  sub _create_socket, which tries ports from 1023 down to 512 to bind to), 
  maybe the ssh object is not destroyed between the loops. You could try:
  
  ** define $ssh as my variable within the loop (not outside as currently)
  ** put the code within the loop in a separate block, containing the 
  my-Definition of $ssh
  ** use undef $ssh at the end of the loop (still within it of course)
  ** Insert some diagnostic code at the beginning of the loop that 
  a) examines the $ssh object before the second loop run and/or 
  b) sleeps for e.g. a minute, so that you can look whats happening with the 
  bound port (netstat -neat from cmdline)
  
  I don't have the Modules installed, so I didn't made tests, sorry.
  
  joe
 
 I tried some of your recommendations, like declaring $ssh in the loop 
 and use undef $ssh at the end, but didn't solve the problem.
 I did use netstat -neat during, and after the script launch. I didn't 
 see anything weird during the script running, I did see something 
 bizarre after :
 
 tcp0  0 192.168.0.3:1023192.168.0.1:22 
 TIME_WAIT  0  0
 
 that line, stayed there for at least a full minute before disappearing. 
 So I decided to add a 2min sleep at the end of the loop... and to my 
 surprise : IT WORKED!
 I used netstat during the 2min sleep, it seems that the connection to 
 the 1023 socket lasts something between 1-2 minutes.
 
 It's weird, I wish there were another way around it. If anybody got an 
 explanation or a better solution about this socket bind for more than a 
 minute, than just disappears enigma, I'd be glad.
 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Net::SSH::Perl bind socket problem

2005-04-06 Thread John Doe
Am Mittwoch, 6. April 2005 12.52 schrieb gui:
 John Doe wrote:
  I don't see the exact reason. But after having a look in the code
  (Perl.pm, sub _create_socket, which tries ports from 1023 down to 512 to
  bind to), maybe the ssh object is not destroyed between the loops. You
  could try:
 
  ** define $ssh as my variable within the loop (not outside as currently)
  ** put the code within the loop in a separate block, containing the
  my-Definition of $ssh
  ** use undef $ssh at the end of the loop (still within it of course)
  ** Insert some diagnostic code at the beginning of the loop that
  a) examines the $ssh object before the second loop run and/or
  b) sleeps for e.g. a minute, so that you can look whats happening with
  the bound port (netstat -neat from cmdline)
 
  I don't have the Modules installed, so I didn't made tests, sorry.
 
  joe

 I tried some of your recommendations, like declaring $ssh in the loop
 and use undef $ssh at the end, but didn't solve the problem.
 I did use netstat -neat during, and after the script launch. I didn't
 see anything weird during the script running, I did see something
 bizarre after :

 tcp0  0 192.168.0.3:1023192.168.0.1:22
 TIME_WAIT  0  0

 that line, stayed there for at least a full minute before disappearing.
 So I decided to add a 2min sleep at the end of the loop... and to my
 surprise : IT WORKED!
 I used netstat during the 2min sleep, it seems that the connection to
 the 1023 socket lasts something between 1-2 minutes.

 It's weird, I wish there were another way around it. If anybody got an
 explanation or a better solution about this socket bind for more than a
 minute, than just disappears enigma, I'd be glad.

This phenomen with the TIME_WAIT was my other thought to explain the behavior 
of your script, but then I decided not to mention it because I thought that 
the sub _create_socket code in Perl.pm will handle this:

* code *
sub _create_socket {
my $ssh = shift;
my $sock = gensym;

 my ($p,$end,$delta) = (0,1,1); # normally we use whatever port we can get
   ($p,$end,$delta) = (1023,512,-1) if $ssh-{config}-get('privileged');

 # allow an explicit bind address
my $addr = $ssh-{config}-get('bind_address');
 $addr = inet_aton($addr) if $addr;
 ($p,$end,$delta) = (1,65535,1) if $addr and not $p;
 $addr ||= INADDR_ANY;

for(; $p != $end; $p += $delta) {
socket($sock, AF_INET, SOCK_STREAM, getprotobyname('tcp') || 0) ||
croak Net::SSH: Can't create socket: $!;
last if not $p or bind($sock, sockaddr_in($p,$addr));
if ($! =~ /Address already in use/i) {
close($sock);
next;
}
croak Net::SSH: Can't bind socket to port $p: $!;
}
 if($p) {
  $ssh-debug(Allocated local port $p.);
  $ssh-{config}-set('localport', $p);
 }

$sock;
}

*--- code ---*

The code tries to bind to several ports (1023 down to 512).

But now, when I look again - but still not deeply enough!... (and use the hint 
the port 1023 was also tried in the _second_ loop run)... the code seems 
only to handle the port already in use case...

Please look at the above code deeper... the croak code could be the problem, 
and a possibility could be not to croak so fast, but try port after port 
until binding has been done or the port range has fully be tested.

I could have a deeper look myself tomorrow ...äh... après-midi, if you wish 
(we're located in the same time zone I think).

btw - where are all the cracks who have the 
instant-shortestpossible-100%solution for all ???

greetings joe

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Net::SSH::Perl bind socket problem

2005-04-05 Thread gui
added debug in the params. Can't find any real clue on what to do 
though, here's what I got :

ubuntu: Reading configuration data /home/gui/.ssh/config
ubuntu: Reading configuration data /etc/ssh_config
ubuntu: Allocated local port 1023.
ubuntu: Connecting to 192.168.0.1, port 22.
ubuntu: Remote protocol version 2.0, remote software version OpenSSH_3.9p1
ubuntu: Net::SSH::Perl Version 1.27, protocol version 2.0.
ubuntu: No compat match: OpenSSH_3.9p1.
ubuntu: Connection established.
ubuntu: Sent key-exchange init (KEXINIT), wait response.
ubuntu: Algorithms, c-s: 3des-cbc hmac-sha1 none
ubuntu: Algorithms, s-c: 3des-cbc hmac-sha1 none
ubuntu: Entering Diffie-Hellman Group 1 key exchange.
ubuntu: Sent DH public key, waiting for reply.
ubuntu: Received host key, type 'ssh-dss'.
ubuntu: Host '192.168.0.1' is known and matches the host key.
ubuntu: Computing shared secret key.
ubuntu: Verifying server signature.
ubuntu: Waiting for NEWKEYS message.
ubuntu: Enabling incoming encryption/MAC/compression.
ubuntu: Send NEWKEYS, enable outgoing encryption/MAC/compression.
ubuntu: Sending request for user-authentication service.
ubuntu: Service accepted: ssh-userauth.
ubuntu: Trying empty user-authentication request.
ubuntu: Authentication methods that can continue: 
publickey,password,keyboard-interactive.
ubuntu: Next method to try is publickey.
ubuntu: Trying pubkey authentication with key file '/home/gui/.ssh/id_rsa'
ubuntu: Login completed, opening dummy shell channel.
ubuntu: channel 0: new [client-session]
ubuntu: Requesting channel_open for channel 0.
ubuntu: channel 0: open confirm rwindow 0 rmax 32768
ubuntu: Got channel open confirmation, requesting shell.
ubuntu: Requesting service shell on channel 0.
ubuntu: channel 1: new [client-session]
ubuntu: Requesting channel_open for channel 1.
ubuntu: Entering interactive session.
ubuntu: Sending command: wget -q http://www.google.com
ubuntu: Requesting service exec on channel 1.
ubuntu: channel 1: open confirm rwindow 0 rmax 32768
ubuntu: input_channel_request: rtype exit-status reply 0
ubuntu: channel 1: rcvd eof
ubuntu: channel 1: output open - drain
ubuntu: channel 1: rcvd close
ubuntu: channel 1: input open - closed
ubuntu: channel 1: close_read
ubuntu: channel 1: obuf empty
ubuntu: channel 1: output drain - closed
ubuntu: channel 1: close_write
ubuntu: channel 1: send close
ubuntu: channel 1: full closed
ubuntu: Reading configuration data /home/gui/.ssh/config
ubuntu: Reading configuration data /etc/ssh_config
Net::SSH: Can't bind socket to port 1023: Adresse déjà utilisée at 
./test_ssh.pl line 50

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Net::SSH::Perl bind socket problem

2005-04-04 Thread gui
hello,
I'm making a simple script that's supposed to update a certain number of 
boxes, spread around the area.
my script is supposed to to connect to every hosts (via a file named 
hosts) using ssh, launch wget to retrieve the patch update, and 
install it.
Things work fine for the first host of the list. But can never get 
beyong that. I get a Net::SSH: Can't bind socket to port 1023: Adresse 
déjà utilisée at ./test_ssh.pl line 46 message.

my question is, how can I unbind the socket used by Net::SSH::Perl ?
here's part of my code:
use strict;
use Net::SSH::Perl;
my ($patchurl,$stout,$sterr,$exit,$ssh);
my @ids = $ENV{HOME}/.ssh/id_rsa;
my %params = (
'protocol' = 2,
'identity_files' = [EMAIL PROTECTED],
);
$patchurl = push @ARGV
open HOSTS, hosts or die je n'ai pas réussi à ouvrir le fichier hosts 
: $!;

while(HOSTS){
(...)
 $ssh = Net::SSH::Perl-new($_, %params);
$ssh-login(root);
($stout,$sterr,$exit) = $ssh-cmd(wget -q $patchurl);
(...)
}
thanks
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Net::SSH::Perl bind socket problem

2005-04-04 Thread mgoland


- Original Message -
From: gui [EMAIL PROTECTED]
Date: Monday, April 4, 2005 3:16 pm
Subject: Net::SSH::Perl bind socket problem

 hello,
 
 I'm making a simple script that's supposed to update a certain 
 number of 
 boxes, spread around the area.
 my script is supposed to to connect to every hosts (via a file 
 named 
 hosts) using ssh, launch wget to retrieve the patch update, and 
 install it.
 Things work fine for the first host of the list. But can never get 
 beyong that. I get a Net::SSH: Can't bind socket to port 1023: 
 Adresse 
 déjà utilisée at ./test_ssh.pl line 46 message.
 
 my question is, how can I unbind the socket used by Net::SSH::Perl ?
not sure about the answare, but why dont you try to debug the comunication


 
 here's part of my code:
 
 use strict;
 use Net::SSH::Perl;
 
 my ($patchurl,$stout,$sterr,$exit,$ssh);
 my @ids = $ENV{HOME}/.ssh/id_rsa;
 
 my %params = (
 'protocol' = 2,
 'identity_files' = [EMAIL PROTECTED],

'port' = 22,
'debug' = 1,


 );
 
 $patchurl = push @ARGV
 
 open HOSTS, hosts or die je n'ai pas réussi à ouvrir le fichier 
 hosts 
 : $!;
 
 while(HOSTS){
 
 (...)
 
 $ssh = Net::SSH::Perl-new($_, %params);
 $ssh-login(root);
 ($stout,$sterr,$exit) = $ssh-cmd(wget -q $patchurl);
 
   (...)
 }
 
 
 thanks
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response
 
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response