且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

更改用户密码

更新时间:2023-12-06 09:31:22

oldpassword -P


新密码

用户名和QUOT; );


但当然看起来没有用。


是否可以静默执行passwd命令,即没有

shell提示(两次)新密码?或者我应该完全看看

另一个方向 - 也许是通过编辑

/ usr / local / etc / passwd文件,是吗?
>
非常感谢一些建议,谢谢。


Happy New Year and all that!

I''d like to write a short PHP script that will allow users to alter
their virtual server password via a secure web form. I had hoped that
I might be able to call the shell passwd command from PHP, something
like this:

exec( "passwd -O $oldpassword -P $newpassword $username" );

but of course that doesn''t seem to work.

Is it possible to execute the passwd command silently, ie without the
shell prompting (twice) for New Password? Or should I be looking in
another direction altogether - perhaps by editing the
/usr/local/etc/passwd file instead, yes?

Some advice would be greatly appreciated, thanks.

oldpassword -P


newpassword


username" );

but of course that doesn''t seem to work.

Is it possible to execute the passwd command silently, ie without the
shell prompting (twice) for New Password? Or should I be looking in
another direction altogether - perhaps by editing the
/usr/local/etc/passwd file instead, yes?

Some advice would be greatly appreciated, thanks.