Sponsored Content
Full Discussion: Clear failed login count
Operating Systems AIX Clear failed login count Post 302574553 by in2nix4life on Thursday 17th of November 2011 01:35:07 PM
Old 11-17-2011
I run into this on a regular basis (dbas\developers constantly forgetting their passwords) so I have it scripted. You're more than welcomed to it:

Code:
#!/usr/bin/perl
#
# clrlogin
#
# description:  simple script to reset unsuccessful logins for a given user
#
#
###########################################################################

use strict;

# set some defaults
my $user;
my $ulogcnt;
my $ulogcntrst;

# check the command line
if(! @ARGV) {
        print "\nUsage: clrlogin 'username'\n\n";
        exit(1);
} elsif (($#ARGV+1) == 1) {
        # store the given username
        $user = shift @ARGV;
} else {
        print "\nIncorrect number of arguments!\n\n";
        exit(1);
}

# display the number of unsuccessful logins for the
# given user
$ulogcnt = `lssec -f /etc/security/lastlog -a "unsuccessful_login_count" -s $user`;
print "\n$ulogcnt\n\n";

# offer to reset unsuccessful logins to 0 or forgeddaboutit
print "Reset unsuccessful logins for $user? [y,n] ";
chomp(my $answer = <STDIN>);

if($answer =~ /^n$/i) {
        print "\nUnsuccessful logins not reset for $user.\n";
        exit(1);
} elsif ($answer =~ /^y$/i) {
        print "\nResetting unsuccessful logins for $user.\n";
        $ulogcntrst = `chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s $user"`;
        print "$ulogcntrst\n";
}

# done
exit(0);

 

10 More Discussions You Might Find Interesting

1. Solaris

how to reset failed login in solaris 8.0

hi, can someone tell me " how to reset failed login in solaris 8.0" a user is not able to login and inspite of my changing password cannot. I believe it must be because the user tried many attempts. how do i reset the failed login for the user. Thanks! karthik (2 Replies)
Discussion started by: karthikosu
2 Replies

2. Solaris

Last Failed Login

Hi, Would appreciate it if someone could shed me some light here as I'm yet to find any related information in this forum with regards to my problem. Basically, I would like to display "Last Unsuccessful login" information when a user successfully logs-in to the system. I can't seem to find... (2 Replies)
Discussion started by: gilberteu
2 Replies

3. Solaris

FTP login failed.

Hi guys, Can you please help me. I have SUN V100 server running solaris 8. I also have a Redhat Linux 6.2 machine and a windows XP machine on the network. I'm trying to copy files from the Linux and XP machines to the V100 server. When I try to ftp to the solaris machine, I'm challenged... (2 Replies)
Discussion started by: Stin
2 Replies

4. UNIX for Dummies Questions & Answers

XLite and OpenIms - Login failed

Hi, I managed to install OpenImsCore and XLite, and then I tried to log in using Bob and Alice usernames, but it doesn't work. I am using Ubuntu 8.04 = Kubuntu. I tried everything I found on Google (changing security settings in HSS and scscf to Digest-MD5 was the last thing I did), but... (0 Replies)
Discussion started by: Zerro
0 Replies

5. Solaris

problem during Recording Failed Login

Dears, i am trying to recording failed login this is the steps which i do:- 1) touch /var/adm/logilog 2) chown root:sys /var/adm/loginlog 3) chmod 600 /var/adm/loginlog ls -l /var/adm/loginlog -rw------- 1 root sys 0 Jul 21 03:52 /var/adm/loginlog 4) change this value in... (3 Replies)
Discussion started by: hosney00ux
3 Replies

6. Windows & DOS: Issues & Discussions

Application failed when remote login

I have an application (EXE file) in a Windows 2003 server. Through a DOS batch script, I called that application file using UNC path and working fine when locally login. But got failed when I tried the same batch script on remote login. The login id has been provided all the below rights: - Log on... (0 Replies)
Discussion started by: r_sethu
0 Replies

7. Solaris

Solaris 2.6 failed login logging

Holla! Sorry to spam the board with all my Solaris 2.6 questions (I just found this forum). My most recent problem is that not ALL failed log-ins are getting logged in /var/log/authlog. It seems to work fine for the "su" command from a non-root user, but the actual "login" command or a desktop... (4 Replies)
Discussion started by: rrossorr
4 Replies

8. Solaris

Console Login Failed..

Dear Unix Team, This is sudhansu once again. I need some tips on below issue. Sometimes we got calls from customer that their console got hangged means they are not able to access the server through console ip. in that case "resetsc -y" will resolve the issue. 2. But couple of days... (2 Replies)
Discussion started by: sudhansu
2 Replies

9. Solaris

Reset failed login count

Hi, Can someone tell me the command to do this in solaris 5.10 please? I've trawled around the internet for ages but all I can find is the AIX command... Thanks (2 Replies)
Discussion started by: Grueben
2 Replies

10. Solaris

IPCS COUNT clear

How to clear IPCS queue count in server? (2 Replies)
Discussion started by: Arasu123
2 Replies
UTMP(5) 						      BSD File Formats Manual							   UTMP(5)

NAME
utmp, wtmp, lastlog -- login records SYNOPSIS
#include <utmp.h> DESCRIPTION
The file <utmp.h> declares the structures used to record information about current users in the file utmp, logins and logouts in the file wtmp, and last logins in the file lastlog. The time stamps of date changes, shutdowns and reboots are also logged in the wtmp file. The wtmp file can grow rapidly on busy systems, and is normally rotated with newsyslog(8). These files must be created manually; if they do not exist, they are not created automatically. #define _PATH_UTMP "/var/run/utmp" #define _PATH_WTMP "/var/log/wtmp" #define _PATH_LASTLOG "/var/log/lastlog" #define UT_NAMESIZE 8 #define UT_LINESIZE 8 #define UT_HOSTSIZE 16 struct lastlog { time_t ll_time; char ll_line[UT_LINESIZE]; char ll_host[UT_HOSTSIZE]; }; struct utmp { char ut_line[UT_LINESIZE]; char ut_name[UT_NAMESIZE]; char ut_host[UT_HOSTSIZE]; time_t ut_time; }; Each time a user logs in, the login(1) program looks up the user's UID in the file lastlog. If it is found, the timestamp of the last time the user logged in, the terminal line and the hostname are written to the standard output, providing the login is not set quiet; see login(1). The login(1) program then records the new login time in the file lastlog. After the new lastlog record is written, the file utmp is opened and the utmp record for the user inserted. This record remains there until the user logs out at which time it is deleted (by clearing the user and host fields, and updating the timestamp field). The utmp file is used by the programs rwho(1), users(1), w(1), and who(1). Next, the login(1) program opens the file wtmp, and appends the user's utmp record. When the user logs out, a utmp record with the tty line, an updated time stamp, and cleared user and host fields is appended to the file by init(8). The wtmp file is used by the programs last(1) and ac(8). In the event of a date change, a shutdown or reboot, the following items are logged in the wtmp file. reboot shutdown A system reboot or shutdown has been initiated. The character '~' is placed in the field ut_line, and reboot or shutdown in the field ut_name (see shutdown(8) and reboot(8)). date The system time has been manually or automatically updated by date(1). The command name date is recorded in the field ut_name. In the field ut_line, the character '|' indicates the time prior to the change, and the character '{' indicates the new time. FILES
/var/run/utmp The utmp file. /var/log/wtmp The wtmp file. /var/log/lastlog The lastlog file. SEE ALSO
last(1), login(1), w(1), who(1), utmpx(5), ac(8), init(8), lastlogin(8), newsyslog(8) HISTORY
A utmp and wtmp file format appeared in Version 6 AT&T UNIX. The lastlog file format appeared in 3.0BSD. BSD
May 14, 2003 BSD
All times are GMT -4. The time now is 03:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy