hi there,
does anyone know how to kick a telneted user from a the system?
thx
hi there,
does anyone know how to kick a telneted user from a the system?
thx
as root do a ps aux from the command prompt
and then look for the shell proccess id and then kill it. also you can kill the telnet session.
Do you want this to be based on a timeout period or are you just intending to remove users before you shutdown the box for maintenance?
Here is a script that you can modify for deleting inactive users. Not mine but useful.
******************cut here********************
# killlogin -- kills login shell of anyone idle more than MIN minutes
#
# MIN = 30 for 30 minutes, 100 for 1 hour, 220 for 2 hour and 20 minutes
#
#-------------------------------------------------------------------------o
#
LOG=/tmp/killpid`date +"%a"`
# if you put LOG in other than tmp set up cron job to clean it out
# put the time at the beginning of the run
date +"%r" >> $LOG
# who -u gets list of ids and idle times
/bin/who -u | /bin/sed 's/://g' | tee -a $LOG |
#----------
while read info
do
set $info
user="${1}"
#echo \$user is $user
case $user in
root) MIN=999999;; # don't time out this user
user1) MIN=400 ;; # don't time out this user for 4 hrs
user2) MIN=800 ;; # don't time out this user for 8 hrs
user3) MIN=800 ;; # don't time out this user for 8 hrs
oracle ) MIN=800 ;; # don't time out this user for 8 hrs
*) MIN=30 ;; # everyone else gets 30 minutes
esac
#echo \$time is $time
#echo \$MIN is $MIN
TTY=$2
if [ "${time}" -gt ${MIN} ] # is time greater than limit in $MIN
then
/bin/kill -1 $7
fi
done
added code tags for readability --oombera
thx