Lock a Solaris User Account after a number of failed login attempts

The following is a simple series of steps to configure an unsuccessful login limit in Solaris without the use of the PAM module. Account lockouts are an adequate measure to combat “brute force” attacks wherein unauthorized access is gained by attempting all possible passwords.

1) edit /etc/default/login and find the line RETRIES (probably commented out). Uncomment RETRIES and make sure it is equal to the maximum number of attempts required by policy (i.e. 5).

2) Then edit /etc/security/policy.conf Go to the end of the file, uncomment LOCK_AFTER_RETRIES, and change the setting to yes - LOCK_AFTER_RETRIES=YES

3) make sure /etc/user_attr has root with no lockout:

EXAMPLE:
more /etc/user_attr
#
# Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
#
# /etc/user_attr
#
# user attributes. see user_attr(4)
#
#pragma ident “@(#)user_attr 1.1 03/07/09 SMI”
#
adm::::profiles=Log Management
lp::::profiles=Printer Management
root::::auths=solaris.*,solaris.grant;profiles=Web Console Management,All;lock_after_retries=no

When someone locks their account, your will see *LK* at the beginning of their password hash in /etc/shadow. To unlock the account just type: passwd -u /locked_user. If you want to check the current failed login attempts for a user it will be the last number on the user’s entry in /etc/shadow.