| Category: | Utilities |
| Author/Contact Info | Octavian |
| Description: | This is a program I wrote when I needed to come up with a way to quickly disable someone for whatever reason, and prevent them from being able to log on, it kills everything that they are running...and it keeps running until killed, so even when they try to log back on it kills them again. This was written on a HP10.20 machine, but it should work on any system that has fuser. |
#!/usr/local/bin/perl
$target = shift(@ARGV);
do{
@users = `finger`;
foreach $line(@users)
{
if(grep(/$target/,$line))
{
@rec = split(/\s+/,$line);
$rec[3] =~ s/\*//;
if(grep(/\D/,$rec[3]))
{
if(grep(/dtr/,$rec[3]))
{
next;
}
elsif(grep(/con/,$rec[3]))
{
`/usr/sbin/fuser -k /dev/console`;
}
else
{
`/usr/sbin/fuser -k /dev/tty$rec[3]`;
}
}
else
{
if(grep(/dtr/,$rec[3]))
{
next;
}
else
{
`/usr/sbin/fuser -k /dev/pts/$rec[3]`;
}
}
}
}
sleep 2;
} until $done eq "done";
|
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Kill User
by Fastolfe (Vicar) on Oct 30, 2000 at 21:25 UTC | |
by Octavian (Monk) on Oct 30, 2000 at 21:34 UTC | |
by Fastolfe (Vicar) on Oct 30, 2000 at 21:41 UTC | |
|
RE: Kill User
by merlyn (Sage) on Oct 30, 2000 at 21:13 UTC | |
|
RE: Kill User
by AgentM (Curate) on Oct 30, 2000 at 21:19 UTC | |
by Octavian (Monk) on Oct 30, 2000 at 21:29 UTC | |
by AgentM (Curate) on Oct 30, 2000 at 21:33 UTC |