Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7822215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:51:43+00:00 2026-06-02T07:51:43+00:00

$con = ssh2_connect($host, 22); ssh2_auth_password($con, $rem_acc, $pass); ssh2_scp_send($con,$rand..gz,./.$rand..gz); $stream = ssh2_exec($con, ./exeonserv.sh .$rand); As

  • 0
$con = ssh2_connect($host, 22);
ssh2_auth_password($con, $rem_acc, $pass);
ssh2_scp_send($con,$rand.".gz","./".$rand.".gz");
$stream = ssh2_exec($con, "./exeonserv.sh ".$rand);

As long as I keep the load to below 2 requests per second to the PHP script (there are 2 SSH connections in the script, so 4 connections per second), this works fine

But the moment it exceeds 2 requests per second, the connection starts failing, with this error in the log:

[Sat Apr 21 11:51:40 2012] [error] [client 172.16.57.97] PHP Warning: ssh2_connect(): Error starting up SSH connection(-1): Failed getting banner in /var/www/fsproj/result.php on line 105
[Sat Apr 21 11:51:40 2012] [error] [client 172.16.57.97] PHP Warning: ssh2_connect(): Unable to connect to localhost in /var/www/fsproj/result.php on line 105

I used the following code to try and solve the issue, but if the sustained load is greater than 2req/sec. it just ends up increasing the response time

$con=false;    
while(!$con)
{
    $con = ssh2_connect($host, 22);
}

Is there a cap on the maximum rate at which SSH connections can be opened? If so where can I change that value? (or any other solutions?)

I’m using Apache on Ubuntu

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:51:44+00:00Added an answer on June 2, 2026 at 7:51 am

    Taking a look at man sshd_config, the following sections seems to control the maximum number of SSH connections that can be opened at once and also the maximum number of concurrent connection attempts. You’ll need to modify /etc/ssh/sshd_config with your desired settings.

         MaxSessions
                 Specifies the maximum number of open sessions permitted per net-
                 work connection.  The default is 10.
    
         MaxStartups
                 Specifies the maximum number of concurrent unauthenticated con-
                 nections to the SSH daemon.  Additional connections will be
                 dropped until authentication succeeds or the LoginGraceTime
                 expires for a connection.  The default is 10.
    
                 Alternatively, random early drop can be enabled by specifying the
                 three colon separated values ``start:rate:full'' (e.g.
                 "10:30:60").  sshd(8) will refuse connection attempts with a
                 probability of ``rate/100'' (30%) if there are currently
                 ``start'' (10) unauthenticated connections.  The probability
                 increases linearly and all connection attempts are refused if the
                 number of unauthenticated connections reaches ``full'' (60).
    

    Additionally, for your example where you are attempting to connect to the server, you may want to add a sleep after failed connection attempts. Without this backoff and the server is flooded, your script may make things worse by attempting to flood the server more with connection attempts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the error i get while executing the code below in OleDb Try con.Open() Dim
Below is my table screenshot: Data after insertion Code in C# SqlConnection con =
I'm using FTPClient con = new FTPClient(); try { con.connect(HOST); if (con.login (LOGIN, PASSWORD))
I have a repeater on my page being populated on page load con.Open(); SqlDataReader
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[erp].ConnectionString); con.Open(); string intero = Select * from judete; SqlCommand
I have the following code: import sqlite3 con = sqlite3.connect(testDB) cur = con.cursor() #cur.execute('CREATE
I'm using the following setup: public MySQLProcessWriter(Connection con) throws SQLException { String returnNames[] =
if (validateEmailId(email)) { pictureBox5.Visible = true; SqlConnection con = new SqlConnection(conection string); SqlCommand cmd2
I find that my constructors are starting to look like this: public MyClass(Container con,
Like the old DOS way of creating a file by writing copy con foo.txt,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.