RE: [Ssh-sftp-perl-users] Using Net::SSH:Perl login()
Brought to you by:
dbrobins
|
From: Moussavi, K. <KMo...@PE...> - 2004-02-03 13:19:50
|
Mr. Fuller,
That is correct. Running "od" did not reveal anything hence why I'm very
confused. As a workaround (it's very ugly) we created a multidimensional
array in a separate script and placed a "require" statement in the original
script. Here is an example of our array:
$array[0] = ("name of site","site IP","machine type","password","phase");
$array[1] = .......
$array[2] = .......
.
.
.
This works.... Again, there are no funny characters in the original text
file. It would be nice if we could simply parse a text file rather than
have to create such funny arrays. Have you guys been able to do so?
Thanks,
Keyvan
-----Original Message-----
From: Mark Fuller [mailto:mar...@ea...]
Sent: Monday, February 02, 2004 8:48 PM
To: Moussavi, Keyvan; ssh...@li...
Subject: Re: [Ssh-sftp-perl-users] Using Net::SSH:Perl login()
>However, this script works if instead of reading the password from a file
we
> explicitly assign the password string to $password (e.g. $password =
> "testpass").
Do I understand correctly that assigning the value from an array (which came
from a split, which operated on data read from a file) doesn't work? But, if
you assign the same value (which you believe is in that array) directly to
the same variable (as a constant) it does work?
If I understand correctly, this would cause me to believe there is
*something* different about the file (or the result of the split) than you
believe. Maybe the file has trailing carriage returns in addition to a
normal lineend and the chomp isn't getting it? Use the MD5 digest function
to get a digest value of each value (your constant assignment and the value
coming from the file after it's in the array). That would tell you if it's
different. Or echo it to the "od -oc" command (on unix) to view the binary
data. I have to believe something is different about the two values.
Mark
----- Original Message -----
From: "Moussavi, Keyvan" <KMo...@PE...>
To: <ssh...@li...>
Cc: "Liberty, Ben" <ben...@pe...>
Sent: Monday, February 02, 2004 11:54 AM
Subject: [Ssh-sftp-perl-users] Using Net::SSH:Perl login()
> Hello,
>
> We've installed the Net::SSH::Perl module on a Red Hat 9 machine and are
> interested in using this module to SSH to several different machines on a
> nightly basis. We parse a file and gather passwords/IP addresses then
> proceed to connect to the remote machines. We are using the module in the
> following manner:
>
> use Net::SSH::Perl;
>
> @lineArray = `/bin/cat $file`;
> foreach $line (@lineArray) {
> chomp $line;
> @tempStringArray = split(/\s+/,$line);
> $password = $tempStringArray[3]; # value grabbed from password
> file.
> $ssh->login("root",$password);
> ($stdout, $stderr, $exit) = $ssh->cmd("ls -l");
> .
> .
> .
> }
>
> Once the script is executed we observe an error message related to DES.pm.
> However, this script works if instead of reading the password from a file
we
> explicitly assign the password string to $password (e.g. $password =
> "testpass"). How is it that the latter method works and how can we modify
> our script so that we can read password strings from a file rather than
> hard-coding passwords in the script?
>
> Much thanks,
>
> Keyvan Moussavi
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by EclipseCon 2004
> Premiere Conference on Open Tools Development and Integration
> See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> http://www.eclipsecon.org/osdn
> _______________________________________________
> Ssh-sftp-perl-users mailing list
> Ssh...@li...
> https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users
|