Re: Net::SSH::Perl sending output to STDOUT

ryanmhuc_at_yahoo.com
Date: 02/09/05


Date: 9 Feb 2005 10:06:29 -0800

Martin,
  I think theres a misunderstanding here. The code i am using is in the
first post. And its not like the method $ssh->login is kicking back an
error here if the pass is wrong it is exiting my program and printing
"Permission denied" to the STDOUT. Of course its not going to login if
the pass is wrong but why in the world is it halting my program?

after executing:
$ssh->login($user || $this_user, $pass);

the program dies and prints
"Permission denied at test.pl line 43"

I don't want my program to exit at this statment if the password is
incorrect. How do I do that? How do I trap it? Perhaps this is the
behavior of the module but what good is it if you can't error trap if
the password is incorrect.

Martin Kissner wrote:
> ryanmhuc@yahoo.com wrote :
> > Thanks for the script but it does the same thing.
>
> What same thing?
>
> > If the password
is
> > incorrect for the login i get:
> > "Permission denied at test.pl line 43"
> > and then it stops the program.
>
> What do you expect? If the pw is incorrect you should't be able to
log
> in, should you?
>
> > The issue is I need to catch this.
The
> > script I'm trying to create logins into about 16 different servers.
> > These servers passwords are not supposed to change but every once
in a
> > while one does. I want the program to not die when it can't login
to
> > the server but instead trap it, let me know and then continue with
the
> > script.
>
> Then you should probably check for success.
> if (your command) {
> do stuff;
> }
> else {
> do other stuff;
> }
>
> btw:
> You'd probably increase your chances of getting qualified help by
> avoiding TOFU quoting an providing some code example.
>
> HTH
> Martin
>
> [ TOFU snipped ]
>
> --
> perl -e 'print
7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
> .32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'



Relevant Pages

  • Re: I am learning C: a little problem with a simple source code
    ... some people actually work on systems were incorrect operation of the ... success or failure. ... program will be used in a shell script. ...
    (comp.lang.c)
  • Re: FTP: 421 Service not available....
    ... Or environment dependencies in your script. ... # Trap various errors ... logit "1. ... function exitfunc { ...
    (comp.os.linux.networking)
  • Re: transfering signals to a subshell
    ... > If you are at the command line and enter the command above, ... trap 2 3 ... Now I run test1 and press ^C immediately: ... The Script is rather long. ...
    (comp.unix.shell)
  • Re: Why does the system hungs?
    ... I tested that script on an linux machine, ... > In this case, we know what you mean (you have a trap message), but you ... That would be HTFS file system corruption, ... Dump not complete ...
    (comp.unix.sco.misc)
  • Re: logon script error message
    ... userName = WshNetwork.UserName ... acess sysvol and run the script manually. ... The error message refers to the line mapping h: ... Maybe the variable userName is incorrect or undefined. ...
    (microsoft.public.windows.server.general)