Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
When locked out, what is the best way to recover please?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
G3nt00
Guru
Guru


Joined: 09 Apr 2023
Posts: 337

PostPosted: Thu Apr 27, 2023 4:21 am    Post subject: When locked out, what is the best way to recover please? Reply with quote

Hi,

I'm fairly new to Gentoo and manage to do all sorts of dumb things to my system. This time I locked myself out. I am sure I used the correct PW, and also sure the keymap was correct.

I have learned that there is a system called faillock, that kicks in after a number of failed attempts. It should also reset after certain time has passed.

This was however not the case on my box... So I booted off the ISO, mounted the disk and started to look for the "tally dir". Not sure I found what I was looking for, but tried
Code:
faillock --reset --user <my username> --dir /etc/security/faillock.conf

and quickly realized that the 'faillock.conf' in the example I managed to goggle, infact was a directory (I should have paid more attention to the switches too- before first coffee). It was not on my system, so gave me an error. Where is this directory located in Gentoo? And what is the correct way of handling such situation (root disabled, no other users to login with)

I ended up, as said above booting the ISO, and then
Code:

# passwd -l <my username>
# passwd -u <my username>
# passwd <my username>
to disable, enable and set a new password...

Please advice if this is not a good/preferred way. Also, is there a faillock.conf somewhere in effect, or is the default (as it seems) to run it with no config file by default?

Thanks
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 541

PostPosted: Thu Apr 27, 2023 5:58 am    Post subject: Re: When locked out, what is the best way to recover please? Reply with quote

G3nt00 wrote:
I'm fairly new to Gentoo and manage to do all sorts of dumb things to my system. This time I locked myself out. I am sure I used the correct PW, and also sure the keymap was correct.

What were you doing before locking you out?
Back to top
View user's profile Send private message
G3nt00
Guru
Guru


Joined: 09 Apr 2023
Posts: 337

PostPosted: Thu Apr 27, 2023 7:00 am    Post subject: Re: When locked out, what is the best way to recover please? Reply with quote

sMueggli wrote:
G3nt00 wrote:
I'm fairly new to Gentoo and manage to do all sorts of dumb things to my system. This time I locked myself out. I am sure I used the correct PW, and also sure the keymap was correct.

What were you doing before locking you out?


Started an 'emerge @world'. It ran and the screen-lock kicked in. I found myself unable to login at that point
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23092

PostPosted: Thu Apr 27, 2023 3:06 pm    Post subject: Reply with quote

Faillock is to prohibit brute-forcing of passwords. If your first attempt was rejected, this was probably not faillock. I believe I have seen problems where an ill-timed update of PAM-related code can cause a pre-existing xscreensaver process to become unable to validate passwords. That was before xscreensaver-6 though, so that might not happen anymore.
Back to top
View user's profile Send private message
duane
Apprentice
Apprentice


Joined: 03 Jun 2002
Posts: 193
Location: Oklahoma City

PostPosted: Fri Apr 28, 2023 1:06 am    Post subject: Reply with quote

Hu wrote:
I believe I have seen problems where an ill-timed update of PAM-related code can cause a pre-existing xscreensaver process to become unable to validate passwords.


That still happens to me with i3lock. I just switch to vt2, log in without X, then kill i3lock.

When I'm updating my custom live iso, that I make with grub-mkrescue, I have to re-emerge pam as the last step any time pam updates during an emerge. Otherwise, it refuses to take passwords when the iso is fully assembled. I've no idea why that happens, or why emerging it twice fixes it.
Back to top
View user's profile Send private message
G3nt00
Guru
Guru


Joined: 09 Apr 2023
Posts: 337

PostPosted: Fri Apr 28, 2023 2:53 pm    Post subject: Reply with quote

Hu wrote:
Faillock is to prohibit brute-forcing of passwords. If your first attempt was rejected, this was probably not faillock. I believe I have seen problems where an ill-timed update of PAM-related code can cause a pre-existing xscreensaver process to become unable to validate passwords. That was before xscreensaver-6 though, so that might not happen anymore.

Well, entering VT2 it told me I had to wait X more minutes. That didn't help though, it was as if it just couldn't look up the pw, at all. I do use Yubikeys, but the have played nice so far...
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20588

PostPosted: Sat Apr 29, 2023 2:55 pm    Post subject: Reply with quote

Here's what I have in my notes. I've never specified the directory with either faillock or its predecessor.
Code:
Reset authentication failure records for username:
$ faillock --user username --reset

Display authentication failure records for username:
$ faillock --user username


Finally:
man faillock:
       --dir /path/to/tally-directory
           The directory where the user files with the failure records are kept. The default is /var/run/faillock.
And that directory does exist on my systems.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
G3nt00
Guru
Guru


Joined: 09 Apr 2023
Posts: 337

PostPosted: Sun Apr 30, 2023 7:38 am    Post subject: Reply with quote

pjp wrote:
Here's what I have in my notes. I've never specified the directory with either faillock or its predecessor.
Code:
Reset authentication failure records for username:
$ faillock --user username --reset

Display authentication failure records for username:
$ faillock --user username


Finally:
man faillock:
       --dir /path/to/tally-directory
           The directory where the user files with the failure records are kept. The default is /var/run/faillock.
And that directory does exist on my systems.

Thanks, will make a note of that too. I suppose it works from the chroot as well (in case the one aactive account is locked?
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20588

PostPosted: Wed May 03, 2023 5:56 pm    Post subject: Reply with quote

G3nt00 wrote:
I suppose it works from the chroot as well (in case the one aactive account is locked?
I haven't experienced the issue in a chroot, but presumably it would occur there too.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
G3nt00
Guru
Guru


Joined: 09 Apr 2023
Posts: 337

PostPosted: Wed May 03, 2023 6:00 pm    Post subject: Reply with quote

pjp wrote:
G3nt00 wrote:
I suppose it works from the chroot as well (in case the one aactive account is locked?
I haven't experienced the issue in a chroot, but presumably it would occur there too.

Well, sorry, I meant resetting in chroot... Or am I overthinking? It would be enough to boot to init=/bin/bash, mount root as rw and reset from there?
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20588

PostPosted: Wed May 03, 2023 6:31 pm    Post subject: Reply with quote

Oh, you mean fixing a normal install from within a chroot... rebooting into separate media? I would expect that to work. If you achieve root access to a system, you should be able to reset the lockout (excluding use of SELinux or anything similar).

I've never had a lockout period set so long that I tried anything of that nature. I usually find something to do for 5 minutes then come back :)

On a similar note, it can often be a good idea to open an additional terminal with root access when you make changes to a system. Similarly, when working on systems with a remote connection, opening a secondary connection is also valuable (and if you need root access on the remote system...).
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
G3nt00
Guru
Guru


Joined: 09 Apr 2023
Posts: 337

PostPosted: Wed May 03, 2023 7:11 pm    Post subject: Reply with quote

pjp wrote:
Oh, you mean fixing a normal install from within a chroot... rebooting into separate media? I would expect that to work. If you achieve root access to a system, you should be able to reset the lockout (excluding use of SELinux or anything similar).

I've never had a lockout period set so long that I tried anything of that nature. I usually find something to do for 5 minutes then come back :)

On a similar note, it can often be a good idea to open an additional terminal with root access when you make changes to a system. Similarly, when working on systems with a remote connection, opening a secondary connection is also valuable (and if you need root access on the remote system...).

Yeah, I learned about the lockout period too late... So went at it to reset it. If I'd knew I would have just waited as well :P
Back to top
View user's profile Send private message
djdunn
l33t
l33t


Joined: 26 Dec 2004
Posts: 812

PostPosted: Sat Jun 17, 2023 1:27 am    Post subject: Reply with quote

If you can login as root just
Code:
su username
exit


That resets an account lockout
_________________
“Music is a moral law. It gives a soul to the Universe, wings to the mind, flight to the imagination, a charm to sadness, gaiety and life to everything. It is the essence of order, and leads to all that is good and just and beautiful.”

― Plato
Back to top
View user's profile Send private message
G3nt00
Guru
Guru


Joined: 09 Apr 2023
Posts: 337

PostPosted: Sat Jun 17, 2023 7:48 am    Post subject: Reply with quote

djdunn wrote:
If you can login as root just
Code:
su username
exit


That resets an account lockout

Well, usually perhaps, but I have the custom to disable root, it's in my first post... Else I do agree with you, would have worked fine as you describe. Didn't know that it resets the lockout though, Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum