Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jul 2020 11:58:40 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Jiang Xu <jiang.xu@citrix.com>
Cc:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: how to reset login in freebsd if the password is expired
Message-ID:  <20200727115840.2c1912ca.freebsd@edvax.de>
In-Reply-To: <1595842414286.43801@citrix.com>
References:  <1595842242103.79959@citrix.com> <1595842414286.43801@citrix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200727115840.2c1912ca.freebsd>