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?

  • Quick question, do you have the ability to install software on the server or is it a business system you have restricted access to? Jun 8, 2015 at 0:29
  • You have to liberalize your brute force settings on the server. Honestly, you really do not need to lock out after 3 attempts, 20-50 is sufficient. If you can not config the server, talk to your sys admin.
    – Panther
    Jun 8, 2015 at 0:40
  • The server is run by other people who will definitely not take my advice on their security settings. I cannot install software on or in any way change the server.
    – spitespike
    Jun 8, 2015 at 0:58

1 Answer 1


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.
  • Thanks, Carl Trask. I have already tried using ControlMaster and ControlPersist in a .ssh/config file. Possibly I have set it up wrong or set the ControlPersist time too low, but I was blocked. It is difficult to tinker with as any attempt to tinker gets me blocked until the admins can unblock me. Do I have to open a ssh connection that remains open while all the subconnections run and if so how do I get a bash to open the requisite terminal tabs/windows/whatevers?
    – spitespike
    Jun 8, 2015 at 2:50
  • One the first ssh connection is established all other connections should use that connection. The connection should remain open until all multiplexed connections close plus the persistence time. Example, you have a 1 hour persistence time. You scp a file to the server at 12:00. You then ssh to the same server at 12:30 (this will use the already established conn) and exit ssh at 12:45. The connection won't close until 1:45.
    – Carl Trask
    Jun 8, 2015 at 3:26
  • Thanks I'll try adjusting the persist time as soon as the current block wears off
    – spitespike
    Jun 8, 2015 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.