2013-04-05 32 views
0

通常chpasswd在設置用戶密碼方面做得非常出色。bash:更改我自己的密碼(不使用root)

有沒有辦法讓非特權用戶更改自己的密碼?

我有興趣爲此編寫一個gtk前端,如果它也需要用戶舊密碼,那麼最好。


Change $user password? 

     Old password [   ] 

     new password [   ] 
new password again [   ] 

[cancel]    [apply] 

尋找

$command 
$enter:oldpass 
$enter:newpass 
password updated 

回答

6

當然有,這裏是密碼的linux

教程和解決方案是

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 
+0

謝謝。試圖弄清楚,當我意識到chpasswd只能用作根。 – user2225483 2013-04-05 05:19:17