error_reporting(E_ALL);
ini_set('display_errors', 1);
$connection = ssh2_connect($server_host, 22);
if(ssh2_auth_password($connection, $login, $password)){
$stdio = ssh2_exec($connection, $command);
stream_set_blocking($stdio, 1);
}
echo "пароль" | passwd --stdin login