Posts

Showing posts from March, 2014

Reset failed logins for a locked user in linux

Q: You are trying to login to a server but you face following message:

"Account locked due to 7 failed logins"

A: It's due to multiple failed logins and you need to reset the failed logins counter.


1. Check number of failed logins:

# pam_tally2 -u user1 -r 
Login    Failures    Latest failure    From 
user1      5         06/18/13 11:24:15 10.15.62.121


2. Reset the failed logins counter with -r option:
# pam_tally2 -u user1 -r 
Login    Failures    Latest failure    From 
user1      5         06/18/13 11:24:15 10.15.62.121

3. Issue the command again to verify:
# pam_tally2 -u user1 
Login    Failures    Latest failure    From 
user1      0          





Extend Swap logical volume in Linux

There are times that you need to extend swap partition in your Linux server, here is the step by step:

1. Check current swap size:

# swapon -s
 Filename                           Type            Size    Used    Priority
 /dev/mapper/vg00-lv_swap           partition       8388604 0       -1


or via lvm commands:

# lvdisplay /dev/vg00/lv_swap
  --- Logical volume ---
  LV Name                /dev/vg00/lv_swap
  VG Name                vg00
  LV UUID                8RTlA8-6R64-N3rz-1kcX-TJHX-yLca-sxxbl8
  LV Write Access        read/write
  LV Status              available
  # open                 2
  LV Size                8.00 GiB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     1024
  Block device           253:4


2. Check if there is enough space available in the VG that contains the swap logical volume. In this case there is 10.87GB free space available:

# vgdisplay /dev/vg00
  --- Volume group ---
  VG Name    …