HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
BladeSystem - General
Showing results for 
Search instead for 
Did you mean: 

Script blade using SSH by PHP

Regular Visitor

Script blade using SSH by PHP



I'm try to configure many blade server on few C7000 enclosure.


i'm correctly conected to my enclosure but each time when i try to connect on one blade i'm directly disconected.


User:OAtmp-Administrator-54003E7C logged-in to 
HP BladeSystem Onboard Administrator
(C) Copyright 2006-2014 Hewlett-Packard Development Company, L.P.

OA-10604BA3D313 [SCRIPT MODE]> connect server 6

Connecting to bay 6 ...

Connection terminated by user's session.

OA-10604BA3D313 [SCRIPT MODE]>  set /system1 oemhp_servername=wxcvbn 

Invalid Arguments

How can i fix my trouble with :

Connection terminated by user's session.


Here is my php code :

 function ssh($host, $login, $mdp, $command)
  if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
   if(!($con = ssh2_connect($host, 22))){
   echo "échec connexion\n";
  else {
   if(!ssh2_auth_password($con, $login, $mdp)) {
            echo "échec authentification\n";
   else {
    // execute a command
    if (!($stream = ssh2_exec($con, $command ))) {
     echo "échec de l'exécution de la commande\n";
    else {
     // collect returning data from command
     stream_set_blocking($stream, true);
     $data = "";
     while ($buf = fread($stream,4096)) {
      $data .= $buf;
     return $data;

 $ch = $_SESSION['c'];
 $la = $_SESSION['l'];
 $no = $_SESSION['n'];

 include ('base_sql.php'); //infos de connexion à la base SQL
   $sql = "SELECT IP_OA FROM `enclosure` WHERE NOM = '$ch'";
   $req = mysql_query($sql);
      $ipc = $ip_enclosure['IP_OA'];
$command = "connect server ".$la."\n set /system1 oemhp_servername=".$no." ";

$ret = ssh($ipc, 'Admin_account', 'password', $command);
echo '<pre>' . $ret . '</pre>';



Thanks by advance or your help.

Regular Visitor

Re: Script blade using SSH by PHP



Nobody have an explaination about "connexion teminated by user's session" just after this command :


connect server "nbr"\n set /system1 oemhp_servername="servername"


Even if i remove 'set /system ...' i have the same issue.


help please .....