You are not logged in.

#1 2017-08-10 15:56:16

ErdosOrGauss
Member
Registered: 2017-06-21
Posts: 40

[SOLVED] Implementing Security Measures and Now I Cannot Login

Hello, I am finally implementing security measures and have successfully locked myself out. This happened after following a few lines of code on the security page and I don't know what I did wrong. Specifically, I implemented the following code in "/etc/pam.d/system-login" to lock out a user for 10 minutes after 3 failed login attempts.

auth required pam_tally2.so deny=2 unlock_time=600 onerr=succeed file=/var/log/faillog
#auth required pam_tally.so onerr=succeed file=/var/log/faillog

When I try logging into any tty, the login seems to not recognize my password? It is almost as if my password changed when I didn't change it. I don't know what to do. I've tried looking around in the forums and haven't found anything. I was hoping there was some workaround I could do? Seeing as how this is the only security measure I implemented (besides having a root and a separate user). So, whatever security vulnerabilities would exist on a new install still exist.

Lastly, I would post a screenshot of what is happening for you, except I cannot login to arch anymore and am posting this from my Windows partition. If there is anything more I can post, please let me know. Furthermore, if there is some arch forum topic or post I have missed despite searching, please let me know.

Thank you for any help in advance.

Last edited by ErdosOrGauss (2017-08-10 17:46:03)

Offline

#2 2017-08-10 15:58:14

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: [SOLVED] Implementing Security Measures and Now I Cannot Login

May I suggest https://wiki.archlinux.org/index.php/change_root  ?

Edit: You can also boot using bash is the init system, as described here.  This is a little more fragile environment than a chroot, but you can do it without boot media.

Last edited by ewaller (2017-08-10 16:01:40)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2017-08-10 16:03:27

ErdosOrGauss
Member
Registered: 2017-06-21
Posts: 40

Re: [SOLVED] Implementing Security Measures and Now I Cannot Login

Thank you for the prompt response! I will try this later today (I'm about to leave for the day) and let you know how it goes! This, however, seems really promising. Thank you.

Offline

#4 2017-08-10 16:10:43

IrvineHimself
Member
From: Scotland
Registered: 2016-08-21
Posts: 275

Re: [SOLVED] Implementing Security Measures and Now I Cannot Login

Constantly tinkering with various security settings, there are many occasions when I have locked myself out, most recently I wiped every single user!

A generic solution that works for me, is to keep a Linux distro on a USB, (any flavour but must be Linux,) from which you can chroot into Arch. From there, you can undo the most recent changes. (Note, if it is just a case of changing a configuration file, sometimes it is possible to edit this file from the rescue USB.)

If like me you are a tinkerer, it can be worthwhile extracting "arch-chroot" from the installation media and placing it in /usr/bin.

see Using_arch-chroot
Irvine

Last edited by IrvineHimself (2017-08-10 16:12:32)


Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!

Offline

#5 2017-08-10 16:11:06

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] Implementing Security Measures and Now I Cannot Login

Can just boot from a LiveCD, and *mount* your usual drive, to be able to edit the PAM files. No actual need to chroot.

Offline

#6 2017-08-10 17:43:21

ErdosOrGauss
Member
Registered: 2017-06-21
Posts: 40

Re: [SOLVED] Implementing Security Measures and Now I Cannot Login

Disclaimer: I'm incredibly sorry for the poor formatting; I typed this response on my phone as I am now beginning a very short road trip. I will include all hyperlinks and specific references later today.

First, thank you to everyone for the incredibly fast responses! You all suggested similar, if not the same, things. And, although they wouldn't have taken very long (because I have a bootable USB on hand), I ended up doing something else while using all of your suggestions as a diving board for my solution. However, I think ewaller may have suggested this but forgot to insert the link. 

To my understanding, my solution only works if you haven't encrypted your hard drive (which I hadn't yet) and are using GRUB (which I am). I initially followed the same steps as changing the root password found here (https://wiki.archlinux.org/index.php/Re … t_password) to gain root access and then modified my changes to "/etc/pam.d/system-login", which were causing my problem. I have included the steps found at the "resetting your root password link" so my solution can be self-contained for anyone experiencing a similar problem.

Here are my steps:

1) Reboot.
2) Select your Linux menu entry and press 'e' to edit it. 
3) Go down to the kernel line, which began with "linux"  in my case, and append "init=/bin/bash" to it. These changes are only temporary, so don't worry.
5) Press ctrl+X to enter a read-only bash shell.
6) So, mount your root account so you may begin editing. You do this by entering the command "mount -n -o remount,rw /". 
7) Next, I simply opened "/etc/pam.d/system-login" using a text-editor (I use vim), deleted what I needed, and saved my changes.
8) I then entered "reboot - f" and was able to login again!

Offline

#7 2017-08-10 18:37:25

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: [SOLVED] Implementing Security Measures and Now I Cannot Login

Glad it worked. Sorry, it looks like I missed the link in my edit hmm but that is what I was suggesting. Reboot worked for you?  It does not always work on my machine (part of why I said it was not stable).  I usually end up doing a sync || sync, and then do a forced shutdown.  (All of this added for the benefit of the next member who reads this thread)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB