0

I want to run multiple commands over ssh (some scp's, some rsync's, and then some ssh commands), but the server has brute force blocking and even though my authentication is fine if I run too many connections in a bash script I get blocked automatically. How can I run the commands I need without getting blocked?

Once possibility: Somebody suggested using ControlMaster in my .ssh/config file so if I open a terminal, open one ssh connection, then all other connections in another terminal won't need to reauthenticate. How can I do that in a bash script? i.e. How do I open one terminal and keep it open till a second terminal runs some commands then close both?

1 Answers1

0

SSH connection multiplexing or connection sharing might solve your problem. Take a look at this ssh multiplexing wiki. It might be able to cut down the number of connections you are making to the server and therefore not trigger the brute force settings.

To answer the second part of the question -- How to do this in a bash script/close other windows. You can probably simplify the problem using ssh keys and a persistent connection.

  • Look at persistent connections that will keep the ssh session open for a set amount of time. Here is a previous answer that covers some of this.
  • Look at implementing key based logins without a password. This will allow your scripts to login without a password. Github has good instructions here.