bash:更改我自己的密码(不使用 root)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15825985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
bash: change my own password (without using root)
提问by user2225483
normally chpasswd does a great job at setting a users password.
通常 chpasswd 在设置用户密码方面做得很好。
is there a way a non-privileged user may change their own password?
非特权用户是否可以更改自己的密码?
i am interested in writing a gtk front end for this, it would be best if it also requires the users old password as well.
我有兴趣为此编写一个 gtk 前端,如果它还需要用户的旧密码,那将是最好的。
Change $user password?
Old password [ ]
new password [ ]
new password again [ ]
[cancel] [apply]
looking for
寻找
$command
$enter:oldpass
$enter:newpass
password updated
回答by Kasnady
Of course there is, here is the tutorial of password in linux
当然有,这里是linux密码教程
and the solution is
解决方案是
Task: Set or Change User Password
Type passwd command as follows to change your own password:
$ passwd
Output:
Changing password for vivek
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
The user is first prompted for his/her old password, if one is present. This password is then encrypted and compared against the stored password. The user has only one chance to enter the correct password. The super user is permitted to bypass this step so that forgotten passwords may be changed.
A new password is tested for complexity. As a general guideline, passwords should consist of 6 to 8 characters including one or more from each of following sets:
Lower case alphabetics
Upper case alphabetics
Digits 0 thru 9
Punctuation marks

