Portál AbcLinuxu, 29. prosince 2025 21:18
function passwd_change($login,$pass)
{
if(sec_check_login($login)!=0) return -2;
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/dev/null", "w") // stderr is a file to write to
);
$pr=proc_open(sprintf("/usr/bin/passwd --stdin %s",$login),$descriptorspec,$p);
if(!is_resource($pr)) return -1;
fwrite($p[0],sprintf("%s\n",$pass));
return proc_close($pr);
}
scp funguje? Kdyby ano, muselo by fungovat i prosté 'echo ... | scp ...'.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.