passwd will not change password

Hello,

I run 12.1-p6 and I am trying to change my main user password. I have tried
Code:
sudo passwd myuser
su
passwd myser
and just plain
passwd from the user's account.
They all complete with success ( echo $? is zero ). But the password is not changed.

Permissions look good on the password files :
Code:
root@charon:~ #    ls -l /etc/*pass*
-rw-------  1 root  wheel  3508 Jun 24 08:30 /etc/master.passwd
-rw-r--r--  1 root  wheel  2862 Jun 24 08:30 /etc/passwd
root@charon:~ #

Nothing specific in the logs and I dont remember playing with PAM settings and they look clean. But nothing works, the password remains the one I used when I created the account on setting up a Freebsd 11 machine a while ago.

Any help would be appreciated.
 

SirDice

Administrator
Staff member
Administrator
Moderator
Judging by the timestamps your password was definitely changed. Are you sure your new password isn't the same as the old one?
 
Yep, pretty sure. I can try sudo with the new password, and it will not work, but it will work with the old password.
 
Every one loves a good reboot, but to no avail. It is still the old password that works and not the new one. I have tried resetting it, did not work again, but the files got touched again.


Code:
[charon:: 12:32] [~] > ls -l /etc/*pass*
-rw-------  1 root  wheel  3508 Jun 24 12:32 /etc/master.passwd
-rw-r--r--  1 root  wheel  2862 Jun 24 12:32 /etc/passwd
[charon:: 12:33] [~] >

Funny thing is, the salt and the hash changed in the master.passwd. But the old password is being pick up anyway. Which is even stranger, since I did a su to root. And yes, root and my user have wildly different passwords, which are rather easy to distinguish.

I'll create a new user and use it to ssh into the machine and then su, juste to test.
 

SirDice

Administrator
Staff member
Administrator
Moderator
Something to try, run vipw (as root). Then save and quit without making any changes. Something appears to be out of sync and this may fix it.
 
That did the trick, new password worked after the vipw. Thank you SirDice.

But still, we have a conundrum :

Creating the new user did not work here is the end of the output :
Code:
......
OK? (yes/no): yes
pw: user 'blabla' disappeared during update
adduser: ERROR: There was an error adding user (blabla).
Add another user? (yes/no): no
Goodbye!
root@charon:

And the user is not functionnal.
 

SirDice

Administrator
Staff member
Administrator
Moderator
Same trick, vipw; save and quit. You will find plenty of threads with that exact same error. Your databases somehow got out of sync.
 
Ho, and yet, both passwd and master.passwd were modified and my new user was there. But the home directory was not created.
 
Same trick, vipw; save and quit. You will find plenty of threads with that exact same error. Your databases somehow got out of sync.

I did do a search for passwd on the forum before. I did not find anything usable. Thank you again. Are there any solutions to that out of sync thing ?
 

SirDice

Administrator
Staff member
Administrator
Moderator
 

Noted, but at my defense, they all seem related to adding users, which just happened to me after talking on this thread. My original problem was really with passwd failling silently.

In any case, thank you, I shall go read those with lots of attention.
 
Same issue on a 12.2-RELEASE system. vipw + :w did the trick.

Note to posterity: If ever you see weird behavior from the passwd command, make sure you haven't been hacked and are dealing with a Trojan passwd binary.

o sha256 /usr/bin/passwd
o Compare to another system running the same version if possible or find the correct checksum elsewhere
o Run some malware checks such as clamav
o If unsure, back up your data and do a fresh install
 
In my case I had two `passwd` tools, for whatever reason. One at `/usr/local/bin/passwd` and another at `/usr/bin/passwd`. Using the latter solved the issue.
 
I'm not seeing anything in the ports tree with bin/passwd in pkg-plist. If you can't explain how /usr/local/bin/passwd came to be, you'll want to verify that you haven't been hacked. A fake passwd command in the default PATH is a good candidate for a Trojan.
 
Top