how to reset login in freebsd if the password is expired

Polytropon freebsd at edvax.de
Mon Jul 27 09:58:46 UTC 2020


On Mon, 27 Jul 2020 09:33:34 +0000, Jiang Xu wrote:
> I set the root login to be expired in 90 days, and we forget
> to update the password of the login, and the password is expired,
> and now we can not login in on it? but we can access the disc
> with attach it to another instance, is there any way to reset
> the expired password?

If you can boot the system on that disk in single-user mode
(and /etc/ttys says your console is marked "secure"), you
can login as root _without_ a password (an emergency shell
is started after the single-user mode boot process has been
completed). Mount the root partition r/w and make whatever
changes are needed ("passwd root" or "pw" command).

If that is not possible, you could manually remove the
encrypted password from /etc/master.passwd and manually
rebuild the password databases /etc/pwd.db and /etc/spwd.db.

See "man 1 passwd", "man 5 passwd" and "man 8 pwd_mkdb"
as well as "man 8 pw" for further details.

Some more hints and examples here:

https://forums.freebsd.org/threads/corrupt-password-file-s.46264/

I assume you have not enabled a "toor" user, which you could
also use... ;-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list