How to change user password to the weak forcedly on OpenBSD 7.1 (not recommended)

nabbisen - Jul 5 '22 - - Dev Community

When you try to change user password on OpenBSD and it is not strong enough, you will see the error:

$ passwd
Changing password for <youruser>.
Old password:
New password:
Please use a more complicated password.
Please use a different password. Unusual capitalization,
control characters, or digits are suggested.
New password:
Enter fullscreen mode Exit fullscreen mode

You had better follow the messages.

Please use a more complicated password.
Please use a different password. Unusual capitalization, control characters, or digits are suggested.

However, some might be sometimes unable to do it.

In such a case, what to do is to encrypt new password manually and then apply it as admin also manually.
Here is the way.

First, encrypt enables you to get new encrypted password:

$ encrypt
# enter your password
# and encrypted chars will be printed
Enter fullscreen mode Exit fullscreen mode

Then, vipw follows to update the password file. Be very careful to edit it:

$ doas vipw
Enter fullscreen mode Exit fullscreen mode

Here, search the line on <youruser> and rewrite it:

  (...)
- <youruser>:currentencryptedpassword:(...)
+ <youruser>:newencryptedpassword:(...)
  (...)
Enter fullscreen mode Exit fullscreen mode

That's it. Check if you can log in with new password:

$ su <youruser>
Password:
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .