|
Posted by new bee on November 5, 2004, 3:37 pm
Please log in for more thread options
Hi, could anyone please help me with this?
I am writing a script that would ssh to a remote computer and execute
commands,
but mine does not get past the logon. Here is my code:
my %args;
$args = '2';
$args = 1;
my @hosts = ("127.0.0.1");
#my $user = "testuser";
my $oldpass = 'xxx';
print "Please enter your username: ";
my $user = <STDIN>;
chomp $user;
foreach my $host (@hosts)
{
my $ssh = Net::SSH::Perl->new($host, %args);
$ssh->login($username5, $oldpass);
....}
This sript dies, with these debug statements:
"acs-114-24.barnard.columbia.edu: Sent key-exchange init (KEXINIT),
wait response.
acs-114-24.barnard.columbia.edu: Algorithms, c->s: 3des-cbc hmac-sha1
none
acs-114-24.barnard.columbia.edu: Algorithms, s->c: 3des-cbc hmac-sha1
none
acs-114-24.barnard.columbia.edu: Entering Diffie-Hellman Group 1 key
exchange.
acs-114-24.barnard.columbia.edu: Sent DH public key, waiting for
reply.
acs-114-24.barnard.columbia.edu: Received host key, type 'ssh-dss'.
acs-114-24.barnard.columbia.edu: Host '127.0.0.1' is known and matches
the host key.
acs-114-24.barnard.columbia.edu: Computing shared secret key.
acs-114-24.barnard.columbia.edu: Verifying server signature.
acs-114-24.barnard.columbia.edu: Waiting for NEWKEYS message.
acs-114-24.barnard.columbia.edu: Enabling incoming
encryption/MAC/compression.
acs-114-24.barnard.columbia.edu: Send NEWKEYS, enable outgoing
encryption/MAC/compression.
acs-114-24.barnard.columbia.edu: Sending request for
user-authentication service.
acs-114-24.barnard.columbia.edu: Service accepted: ssh-userauth.
acs-114-24.barnard.columbia.edu: Trying empty user-authentication
request.
input must be 8 bytes long at
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Crypt/DES.pm
line 59."
However, if instead of prompting the user to enter the username, I
simply do
$user = "testuser"
then there is no problem and I can login just fine.
The problem probably lies with input from stdin not being exactly the
same as 'testuser', but I print the input out just before sending it
to login, and it prints 'testuser'. Does anyone have any ideas that
may help me?
Thank you so much,
Michael
|
|
Posted by Jim Keenan on November 6, 2004, 6:00 pm
Please log in for more thread options
new bee wrote:
> Hi, could anyone please help me with this?
>
> I am writing a script that would ssh to a remote computer and execute
> commands,
> but mine does not get past the logon. Here is my code:
>
> my %args;
> $args = '2';
> $args = 1;
>
> my @hosts = ("127.0.0.1");
>
> #my $user = "testuser";
> my $oldpass = 'xxx';
>
> print "Please enter your username: ";
> my $user = <STDIN>;
> chomp $user;
>
> foreach my $host (@hosts)
> {
> my $ssh = Net::SSH::Perl->new($host, %args);
>
> $ssh->login($username5, $oldpass);
Where does $username5 come from? Shouldn't it have been $user?
|
|
Posted by ___cliff rayman___ on November 6, 2004, 7:36 pm
Please log in for more thread options see lots of comments inline, all the way down to the bottom.
new bee wrote:
>Hi, could anyone please help me with this?
>
>I am writing a script that would ssh to a remote computer and execute
>commands,
>but mine does not get past the logon. Here is my code:
>
use warnings;
use strict;
# the above two lines will tell you what the problem is. use them in
all of your programs.
>
>my %args;
>$args = '2';
>$args = 1;
>
>my @hosts = ("127.0.0.1");
>
>#my $user = "testuser";
>my $oldpass = 'xxx';
>
>print "Please enter your username: ";
>my $user = <STDIN>;
>chomp $user;
>
>foreach my $host (@hosts)
>{
> my $ssh = Net::SSH::Perl->new($host, %args);
>
> $ssh->login($username5, $oldpass);
>
an error would be reported here if you had used: "use strict".
>...}
>
>This sript dies, with these debug statements:
>"acs-114-24.barnard.columbia.edu: Sent key-exchange init (KEXINIT),
>wait response.
>acs-114-24.barnard.columbia.edu: Algorithms, c->s: 3des-cbc hmac-sha1
>none
>acs-114-24.barnard.columbia.edu: Algorithms, s->c: 3des-cbc hmac-sha1
>none
>acs-114-24.barnard.columbia.edu: Entering Diffie-Hellman Group 1 key
>exchange.
>acs-114-24.barnard.columbia.edu: Sent DH public key, waiting for
>reply.
>acs-114-24.barnard.columbia.edu: Received host key, type 'ssh-dss'.
>acs-114-24.barnard.columbia.edu: Host '127.0.0.1' is known and matches
>the host key.
>acs-114-24.barnard.columbia.edu: Computing shared secret key.
>acs-114-24.barnard.columbia.edu: Verifying server signature.
>acs-114-24.barnard.columbia.edu: Waiting for NEWKEYS message.
>acs-114-24.barnard.columbia.edu: Enabling incoming
>encryption/MAC/compression.
>acs-114-24.barnard.columbia.edu: Send NEWKEYS, enable outgoing
>encryption/MAC/compression.
>acs-114-24.barnard.columbia.edu: Sending request for
>user-authentication service.
>acs-114-24.barnard.columbia.edu: Service accepted: ssh-userauth.
>acs-114-24.barnard.columbia.edu: Trying empty user-authentication
>request.
>
here is an error message that further gives a hint about what the
problem is.
>input must be 8 bytes long at
>/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Crypt/DES.pm
>line 59."
>
>
--
_____cliff_rayman_____cliff_@_rayman_._com_____
|
| Similar Threads | Posted | | Perl module for cookie/logon/session management with Apache | May 10, 2007, 12:40 pm |
| How to get service logon user | January 31, 2006, 9:36 am |
| username passwd expect | September 14, 2006, 12:36 am |
| Determine NT domain username of web client | February 3, 2005, 4:24 pm |
| Passing username and password using LWP::UserAgent | December 11, 2006, 4:40 am |
| Looking for module that will expands domain/username to email address | October 23, 2004, 12:56 am |
| ANNOUNCE: Initial release of WSF/Perl (Perl bindings for a WS-* framework) | October 4, 2007, 1:37 am |
| PLJava - Perl embeded into Java (calling Perl from Java) - 1sr release - call for tests and review, please. | July 13, 2004, 4:06 am |
| Perl MakeMaker - how to force Perl linking with the static C library (libcrt.lib) instead of dynamic C library (msvcrt.lib) | April 17, 2007, 5:22 pm |
| MFC with Perl | July 19, 2005, 9:38 pm |
|