So basically ive been using this for atleast 5 months now and its been all fine now just a few days ago it just stopped working no changes has been made and i dont think any updates would cause this? as i havent done any changes at all.
$connection = ssh2_connect('ip', 22);
ssh2_auth_password($connection, 'root', 'oo');
$cmd = ssh2_exec($connection, 'useradd '.$username.' -s /bin/false; echo -e "'.$password.'\n'.$password.'" | passwd '.$username.'');
So basically what happens is that it connect just nicely but it changes the root password? extremely wierd i would appreciate any help i could get as i am clueless.
Thanks!
$connection = ssh2_connect('ip', 22);
ssh2_auth_password($connection, 'root', 'oo');
$cmd = ssh2_exec($connection, 'useradd '.$username.' -s /bin/false; echo -e "'.$password.'\n'.$password.'" | passwd '.$username.'');
So basically what happens is that it connect just nicely but it changes the root password? extremely wierd i would appreciate any help i could get as i am clueless.
Code:
<?php
ini_set('max_execution_time', 60);
define("_VALID_PHP", true);
if (isset($_POST['create'])) {
$username = $_POST['user_id'];
$password = $_POST['password'];
// server 1 cmd
$connection = ssh2_connect('ip', 22);
ssh2_auth_password($connection, 'root', 'pw');
$cmd = ssh2_exec($connection, 'useradd '.$username.' -s /bin/false; echo -e "'.$password.'\n'.$password.'" | passwd '.$username.'');
}
?>
<!DOCTYPE HTML>
<body>
<form method="POST">
<div class="field">
<label class="left">User ID:</label>
<input type="text" name="username">
</div>
<div class="field">
<label class="left">Password:</label>
<input type="text" name="password">
</div>
<div class="field">
<input type="submit" name="create" value="Create">
</div>
</form>
</body>
</html>
Thanks!
Last edited by a moderator: