ako zmeni heslo uzivatela cez php pouzitim ssh2?
skusam to takto
Kód: Vybrať všetko
$command1 = "/usr/sbin/useradd " . $user_meno;
$command2 = "/usr/bin/passwd " . $user_meno ;
$command3 = $user_heslo;
echo $a = $shell->cmdExec_ret($command1);
echo $a = $shell->cmdExec_ret($command2);
echo $a = $shell->cmdExec_ret($command3);
echo $a = $shell->cmdExec_ret($command3);Kód: Vybrať všetko
function cmdExec_ret(){
$argc = func_num_args();
$argv = func_get_args();
$cmd = '';
for($i=0; $i<$argc ; $i++){
if( $i != ($argc-1) ) {
$cmd .= $argv[$i]." && ";
}else{
$cmd .= $argv[$i];
}
}
$stream = ssh2_exec($this->con, $cmd, $this->shell_type);
stream_set_blocking($stream, true);
return fread($stream, 4096);
}Kód: Vybrať všetko
Changing password for user uzivatel. bash: heslo: command not found bash: heslo: command not foundmate nejake napady?