Mailinglist Archive: opensuse (4547 mails)

< Previous Next >
Re: [SLE] Forcing a user to logout
  • From: Louis Richards <louis@xxxxxxxxxxxxxxxxxx>
  • Date: Mon, 17 May 2004 10:04:14 -0400
  • Message-id: <40A8C65E.1020308@xxxxxxxxxxxxxxxxxx>
Pieter Hulshoff wrote:

On Mon, May 17, 2004 at 06:27:28AM -0700, Prabu Subroto wrote:

Please teach me which command line in the console
which I can use to display which users are being
logged in. They login through NIS.

And please tell me which command line that I can use
to kick the user out (forcing logout). If they login
through NIS.


A simple who should tell you who's logged in. A ps should
tell you which process is used to be logged in, and kill
is always useful in kicking them off. Are these users not
supposed to be able to log in or do you want to kick a
certain type of user?

Regards,

Pieter Hulshoff



Sometimes killing the root process (normaly /bin/bash) will still leave running processes.

This is not very complete, however, it should work. Name it somthing like 'killuser' and run 'killuser username'. NOTE: This is mean ... unforgiving ... and sometimes fun (I did this to my wife ... just as she was about to win her card game ... ONCE ;-) ).

#!/bin/bash
echo
echo "----------------------------------------------"
echo Killing all processes owned by user $1
echo "----------------------------------------------"
kill -9 `ps -u $1 -o "pid="`
echo "----------------------------------------------"
echo There are `ps -u $1 -o "pid=" | grep -c ""` processes left for user $1
echo "----------------------------------------------"
echo


--

Louis D. Richards
LDR Interactive Technologies


< Previous Next >