Re: [Ssh-sftp-perl-users] Problem With Net::SSH:Perl
Brought to you by:
dbrobins
From: <<<<Amar>>>> <ama...@gm...> - 2009-06-17 13:22:33
|
Hello You need to create public/private keys via SSH-keygen You can refer for any documentation of how to set up password less SSH login. ~Amardeep. On Wed, Jun 17, 2009 at 3:36 PM, cheerla sreehari <ch....@gm...>wrote: > Hi , > > I exactly used the code given by you by just changing the $host and $passwd > . When I execute that it is still prompting for the password . > > So we need to configure SSH for not prompting the password ? > > Thanks for the help . > > Regards, > SreeHari CH > > > On Wed, Jun 17, 2009 at 5:32 AM, Ian Docherty <Ian...@bd...> wrote: > >> Hi >> >> You need to include all of your code when you report problems, or at least >> a ‘cut-down’ fully working program that demonstrates the problem. >> >> >> >> If you had done so in this case we could have seen that you had not >> included the following in your perl program. >> >> >> >> *use strict;* >> >> *use warnings;* >> >> * * >> >> I can tell that you have not done so since you your *interactive=>FALSE*would have given a warning like >> >> >> >> *Bareword "FALSE" not allowed while "strict subs" in use at ssh.pl line >> 10.* >> >> >> >> This is doing the exact opposite of what you are expecting. Since you have >> not turned on *strict* and *warnings* pragmas then perl is converting the >> *FALSE* into a scalar, which is then being evaluated as a true value so >> requesting the prompt! >> >> >> >> If you read the documentation you will see that it defaults to false (perl >> false not FALSE) so it should not request the password. >> >> >> >> A complete example (which I have tested) is as follows. >> >> >> >> #!/usr/bin/perl >> >> use Net::SSH::Perl; >> >> >> >> use strict; >> >> use warnings; >> >> >> >> my $host = 'your.domain.com'; >> >> my $user = 'root'; >> >> my $passwd = 'secret'; >> >> >> >> my $scon = Net::SSH::Perl->new ($host); >> >> $scon->login($user, $passwd); >> >> print "looking around...\n"; >> >> my ($output, $errors, $exit) = $scon->cmd("ls -l"); >> >> print "output=[$output] errors=[$errors] exit=[$exit]\n"; >> >> >> >> If this still does not work then you have to double check that you can ssh >> onto the host using the credentials you are putting into your program. >> >> >> >> Regards >> >> Ian >> >> >> ------------------------------ >> >> *From:* cheerla sreehari [mailto:ch....@gm...] >> *Sent:* 17 June 2009 06:22 >> *To:* ssh...@li... >> *Subject:* [Ssh-sftp-perl-users] Problem With Net::SSH:Perl >> >> >> >> Hi , >> >> I am using the following code to connect to the remote host . >> use Net::SSH::Perl ; >> >> $scon = Net::SSH::Perl->new ("$host",interactive=>FALSE); >> $scon->login("root","$passwd"); >> print "looking around ...\n"; >> ($output,$errors,$exit) = $scon->cmd("ls -l"); >> print $output; >> >> >> >> When I execute this code , it is prompting for the password . >> I want to ssh without prompting for the password . >> >> Please suggest me how I can modify the above code to ssh a client without >> prompting for the password . >> >> Thanks in Advance . >> >> Regards, >> SreeHari CH >> This email is confidential and intended solely for the use of the >> individual to whom it is addressed. Any views or opinions presented are >> solely those of the author and do not necessarily represent those of RedBee >> Media Metadata. If you are not the intended recipient, be advised that you >> have received this email in error and that any use, dissemination, >> forwarding, printing, or copying of this email is strictly prohibited. If >> you have received this email in error please notify the sender. >> >> Red Bee Media Metadata is a trading name of Broadcasting Dataservices >> Limited. >> Registered in England and Wales No.: 2554733. Registered Office: 201 Wood >> Lane, London W12 7TP, UK. >> Broadcasting Dataservices Limited is a wholly owned subsidiary of Red Bee >> Media Limited. >> > > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > |