0

I have a script that reads an input file with twenty command lines to be tested against remote servers through SSH command line and I need your help to find out how to limit the ssh login attempts in case of failure.

Remote servers configuration file:

IP1:User:Hostname1:commandline1

IP1:User:Hostname1:commandline2

IP1:User:Hostname1:commandline3

IP1:User:Hostname1:commandline4

. . .

IP2:User:Hostname2:commandline1

IP2:User:Hostname2:commandline2

IP2:User:Hostname2:commandline3

IP2:User:Hostname2:commandline4

. . .

The issue is, I am being asked more than 5 times to provide the password for each line in case of authentication error and I would like to:

  1. limit the attempts to 3; and in case of failure
  2. save the output error to a variable, this way I can set my script to jump to the next host

Could you help me?

1 Answer 1

1

I got a workaround for my requirement.

Instead of using a ssh connection directly, I used a scp command line to validate the user's credentials before ssh connection, than I used the output value to decide the next steps.

(I guess it was the easier way).

Thanks.

Not the answer you're looking for? Browse other questions tagged .