更改用户密码 [英] Altering users passwords

查看:74
本文介绍了更改用户密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新年快乐等等!


我想写一个简短的PHP脚本,允许用户改变他们的虚拟服务器
密码通过安全的Web表单。我原本希望

我可以从PHP调用shell passwd命令,这样的东西

这样:


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


但当然看起来不行。


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

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

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

/ usr / local / etc / passwd文件,是吗?

一些建议将不胜感激,谢谢。

解决方案

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.


这篇关于更改用户密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆