tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: digiunix <digiunix () mindspring ! com>
To: tru64-unix-managers
Subject: SUMMARY Kill Script to remove lat terminals, and telnet sessions
Date: Thu, 30 Dec 1999 00:23:23 +0000	[thread overview]
Message-ID: <96079271218301.tru64-unix-managers.marc@archive.invalid> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="--Boundary_(ID_V/MNS3qXzr+Z/Y+R25iqDA)", Size: 4474 bytes --]

This is a multi-part message in MIME format.

--Boundary_(ID_V/MNS3qXzr+Z/Y+R25iqDA)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 8BIT

On Thu, 23 Dec 1999 digiunix@mindspring.com wrote:

Howdie little Buckaroos!
Does anyone have a good kill script for kornshell.

I have lat connections and telnet sessions, I need to kill logon
sessions at 1:00am, but exclude a core group of people, like sysadmin,
database admin, etc. If possible I could use a kill script for informix
database logon connections also, excluding the database admin.

HERE IS WHAT I DID

I wanted to kill off the lat connections after the DBA on informix
kicked off the users from database
Late at night, and then I would do the cleanup on the lat connections
that were still there. We had 200 lat connections and over 30 pc
connections on tty.

I used Marco.Luchini@acco-uk.co.uk . This will disallow or grep out what
I don't want killed off which would be root, informix, and a few key
people that should stay logged onto the system.

ALLOWED_LIST="root|sysops|dba"
kill `ps aux | grep -v grep | grep -v -E "$ALLOWED_LIST" | awk '{print
$2}' `

and then added some more to it.

Here is the script and crontab entry

#!/bin/ksh
# test.kill.ksh

ALLOWED_LIST="root|informix|sam|doug|what's his name"

# list of lat and tty processess that will be killed dumped to log file!

ps -ef | grep -v grep | grep -v root | grep tty | grep -v -E
"$ALLOWED_LIST� >> /usr/dgital/test.kill.log 2>&1
ps -ef | grep -v grep | grep -v root | grep lat | grep -v -E
"$ALLOWED_LIST� >> /usr/digital/test.kill.log 2>&1

# lat and ttyp processes that will be killed at night

# kill `ps -ef | grep -v grep | grep -v root | grep tty | grep -v -E
"$ALLOWED_LIST� | awk '{print $2}I�` >> /usr/digital/test.kill.log 2>&1
# kill `ps -ef | grep -v grep | grep -v root | grep lat | grep -v -E
"$ALLOWED_LIST� | awk '{print $2}I�` >> /usr/digital/test.kill.log 2>&1


To test the script do the following
# ksh -x test.kill.ksh


---------------------------------------------------------------------------------------------------------------------

Here were the suggestions

Lucio Chiappetti lucio@ifctr.mi.cnr.it
It was written by some guy farrell@pangea.Stanford.EDU (or perhaps
reynolds@icgmfg.mke.ab.com), so I suppose you should ask them for the
source.

---------------------------------------------------------------------------------------------------------------------

Marco.Luchini@acco-uk.co.uk

ALLOWED_LIST="root|sysops|dba"
kill `ps aux | grep -v grep | grep -v -E "$ALLOWED_LIST" | awk '{print
$2}'
`
sleep 10
kill -9 `ps aux | grep -v grep | grep -v -E "$ALLOWED_LIST" | awk
'{print
$2}' `
is what we use.  Customise at leisure with various "wall" commands to
warn
people etc.  You might also want to
cat << EOF > /etc/nologin
No logins allowed at this time
EOF

to prevent them getting back on.  If the users are getting via an rexec
to the database though, that won't be enough and you'll have to switch
your database authorization file with a restricted one.

---------------------------------------------------------------------------------------------------------------------

Kurt Carlson <kcarlson@arsc.edu>

there is a kill script included in the examples directory of:
http://www.arsc.edu/~kcarlson/software/Software.html#uakpacct
using the included uaklogin program.  kurt

---------------------------------------------------------------------------------------------------------------------

also www.ugu.com  (big unix site)
Universe Guru

Administrative tools

http://www.ugu.com/sui/ugu/show?I=software.admintools&F=1111111111&G=Y







--
--------------------------------------------------------
Larry A. Magnello  larry.magnello@usa.net
Unix System Administrator TRU64 Unix System Administrator
DEC Unix, Solaris Unix, HP Unix, Linux Unix Sco Unix
Veritas Volume manager, DEC Logic Storage Manager
http://halite.westal.com/webstuff/fadein.html
--------------------------------------------------------


--Boundary_(ID_V/MNS3qXzr+Z/Y+R25iqDA)
Content-type: text/x-vcard; name=digiunix.vcf; charset=us-ascii
Content-description: Card for digiunix
Content-disposition: attachment; filename=digiunix.vcf
Content-transfer-encoding: 7BIT

begin:vcard 
n:Magnello;Larry
tel;work:Unix System Adminsitration Consulting
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:larry.magnello@usa.net
fn:Larry Magnello
end:vcard

--Boundary_(ID_V/MNS3qXzr+Z/Y+R25iqDA)--

                 reply	other threads:[~1999-12-30  0:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox