NAME
ku, killuser - shell admin utility
SYNOPSIS
ku [-abhHKgGimpstTuxvV] [--all] [--beep] [--header]
[--kill] [--group name] [--gid gid] [--idle minutes]
[--message] [--prompt] [--string pattern] [--telnet]
[--tty tty] [--user user] [--xterm] [--verbose] [--help]
[--version]
DESCRIPTION
ku (killuser) is a utmp based shell admin utility similar
to Slay. ku was written in C in hopes for an increase in
program speed, efficency, and availability of more
options, as opposed to other shell/perl scripts that are
around. It was designed to ease the pain of admins who
use ps and kill to disconnect users from their server.
A wide range of options are offered to satisfy most any
possible condition associated with a shell login.
EXPLANATION
ku tries to prove each option on the command line to be
TRUE or FALSE , if ku found even one of the options to be
FALSE , then ku will skip that shell/user, and continue
until all users/shells have been examined. This type of
system allows for many options to be issued together,
allowing greater flexability in what shells are termi-
nated, and what shells are not.
OPTIONS
-a, -all, --all
terminates any shell of any user logged in except
for yours of course.
Example: 'ku -a'
-b, -beep, --beep
beeps with each termination of a shell. this
option must be used in conjunction with another
option such as --all, --telnet, --user, --group,
--gid, --idle, --xterm, or --string
Example: 'ku -ab'
-h, -header, --header
adds a header when -v (--verbose) is used adds the
header:
USER TERM LOGIN TIME IDLE FROM
when -v, --verbose options are used. This option
also requires the use of another options such as:
--all, --telnet, --user, --group, --gid, --idle,
--xterm, or --string
Example: 'ku -avh'
-K, -kill, --kill
displays default kill message that was specified
using the 'configure' script.
Example: 'ku -K'
-g, -group, --group <group>
terminates any shell of a user that is in the group
<group>.
Example: 'ku -g users'
-G, -gid, --gid <gid>
terminates any shell of a user that has a GID
matching <gid>. NOTE: the GID 100 is the group
'users' on my system.
Example: 'ku -G 100'
-i, -idle, --idle <minutes>
terminates any shell that has not had a keystroke
in the last <minutes> or greater.
Example: 'ku -i 45'
-p, -prompt, --prompt
prompt for permission before a shell is terminated.
the accepted responses are: Y/y , N/n , and ?
when: Y/y is received then that shell is terminated.
when: N/n is received then that shell is skipped.
when: ? is received then ku will display informa-
tion regarding that shell/user in this fashion:
phuzz tty1 0464 Aug 29 18:38 [localhost]
then prompt you again for that same shell/user. if
any other keystroke besides the accpeted values are
given ku will treat it as a N/n. This option also
requires the use of another options such as: --all,
--telnet, --user, --group, --gid, --idle, --xterm,
or --string
-m, -message, --message [optional message]
when this option is specified ku will attempt to
print the [optional message], or if no message was
specified, the default message to the user's tty
before the shell is terminated. NOTE: if you spec-
ify a 'kill message' you are allowed to use the
variables: %l, %r, %g, %G, %h, %H, %p, %s, %t, %Y,
and %V in your message. each variable will be re-
evaluated for each user/shell. See the section
MESSAGES AND VARIABLES for more information on each
variable's resolved value. This option also
requires the use of another options such as: --all,
--telnet, --user, --group, --gid, --idle, --xterm,
or --string
NOTE: when you issue you the -m option it should be
the last option given see BUGS for more information
Example: 'ku -a -m %l you smell go away'
-s, -string, --string <pattern>
this option attempts to match <pattern> in the
user's tty, hostname, and login name.
Example 1: 'ku -s roo'
(terminate any shell with 'roo' in the user name)
Example 2: 'ku -s tty'
(terminate any shell with 'tty' in the tty name *grin*)
Example 3: 'ku -s whitehouse.gov'
(terminate any shell logged in from 'whitehouse.gov')
-t, -telnet, --telnet
with this option issued, ku will skip any users
that are not telnetted to your server. All local-
host logins and console logins are skipped.
Example: 'ku -t'
-T, -tty, --tty <tty>
terminates the shell of the user who is logged in
on <tty>
Example: 'ku -T ttyp0'
-u, -user, --user <user>
with this option, ku will try and find any user
logged in that is an exact match for <user>, and
terminate that user's shell.
Example: 'ku -u hogboy'
-v, -verbose, --verbose
when issued this option will print information
about each user/shell that was terminated in this
fasion:
phuzz tty3 0121 Aug 29 20:46 [localhost]
This option also requires the use of another
options such as: --all, --telnet, --user, --group,
--gid, --idle, --xterm, or --string
Example: 'ku -v -u phuzz'
-H, --help
shows ku 's help screen
-V, --version
prints version information about ku
MESSAGES AND VARIABLES
The following are some variables that can be used
in the message:
%l (for the users login name)
%r (for the users real name)
%g (for the group id)
%G (for the group name)
%h (for the home directory)
%H (for the host)
%p (for the pid)
%s (for the shell)
%t (for the tty)
%Y (for your login name)
%V (for program name and version)
SOME EXAMPLES:
%l your real name is: %r
would say something like:
phuzz your real name is: Nathan Benson
%l (%p:%t)
would say something like:
phuzz (4176:ttyp1)
%l:%g:%G:%s:%h
would say something like:
phuzz:100:users:/bin/bash:/home/m/phuzz
I think you get the basic idea, there are many pos-
sible combinations that can be created from the
available variables, just use your imagination.
when using the --message option anywhere but at the end of
the command line, ku will take everything issued after the
--message option as a part of the literal kill message
so if you issued 'ku -m -avh' , ku would think the message
it was supposed to print was '-avh'. this problem stems
from the way ku was coded not require quotation marks
around the whole message to make get_opt_only() accept the
whole message as the single ooppttaarrgg.. instead ku was coded
to parse each argv[x] AFTER the --message option was
issued, as part of the message.
FIX
use quotation marks around the message body, or make sure
that the --message option is the last option issued.
ku -m "%l smells like chicken" -avh
or
ku -avh -m %l smells like chicken
AUTHOR
Nathan Benson (size_t@hotmail.com)
But many thanks go out to my friends:
seymour: for showing interest and taking part in
beta testing
truE_: for beta testing and just being you
boomy: much thanks to this man, without his kind
words of praise, and reassurance i might have never
finished it.
Linux community: to everyone who ever coded a pro-
gram for other people to use, that is what made me
start this project.
FILES
/dev/tty*